class Rediska::Databases::PStore
Public Class Methods
db_name(id)
click to toggle source
# File lib/rediska/databases/pstore.rb, line 61 def db_name(id) "redis-#{id}" end
flushall(instance_key)
click to toggle source
# File lib/rediska/databases/pstore.rb, line 52 def flushall(instance_key) store = pstore(instance_key) store.transaction { store.roots.each {|r| store.delete(r) } } end
flushdb(instance_key, id)
click to toggle source
# File lib/rediska/databases/pstore.rb, line 47 def flushdb(instance_key, id) store = pstore(instance_key) store.transaction { store.delete(db_name(id)) } end
new(instance_key, id)
click to toggle source
Calls superclass method
# File lib/rediska/databases/pstore.rb, line 27 def initialize(instance_key, id) @id = id @store = self.class.pstore(instance_key) @store.transaction do @store[db_name] ||= {} @db = @store[db_name] end super() end
pstore(instance_key)
click to toggle source
# File lib/rediska/databases/pstore.rb, line 57 def pstore(instance_key) Utilities::SyncedPStore.new(File.join(Dir.tmpdir, instance_key.to_s)) end
Public Instance Methods
method_missing(*args, &block)
click to toggle source
# File lib/rediska/databases/pstore.rb, line 39 def method_missing(*args, &block) @store.transaction do hash = @db hash.send(*args, &block) end end
Private Instance Methods
db_name()
click to toggle source
# File lib/rediska/databases/pstore.rb, line 67 def db_name self.class.db_name(@id) end