Skip to content

Commit

Permalink
expose litekd configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
oldmoe committed Jun 22, 2024
1 parent c579a87 commit f8283e9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/litestack/litekd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,19 @@ module Litekd
mmap_size: 32 * 1024 * 1024, # 32MB
}

def self.connection(options = {})
def self.connection()
# configuration should be loaded here
@@connection ||= Litekd::Connection.new(DEFAULT_OPTIONS.merge(options))
end

def self.options
@@options ||= {}
end

def self.configure(options = {})
@@options = options
end

# scalars
def self.string(key, **args) = Scalar.new(key, typed: :string, **args)
def self.integer(key, **args) = Scalar.new(key, typed: :integer, **args)
Expand Down
2 changes: 2 additions & 0 deletions test/test_litekd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

Kredis = Litekd

Litekd.configure({path: ":memory:"})

class Person

include Litekd::Attributes
Expand Down

0 comments on commit f8283e9

Please sign in to comment.