Class: Irc::Bot::Registry::TokyoCabinetAccessor
- Inherits:
-
AbstractAccessor
show all
- Defined in:
- /home/apoc/projects/ruby/rbot/lib/rbot/registry/tc.rb
Instance Attribute Summary
#filename, #recovery
Instance Method Summary
(collapse)
#[], #[]=, #clear, #close, #create_folders, #dbexists?, #default, #each, #each_key, #each_value, get_impl, #has_key?, #has_value?, #index, #keys, #length, #restore, #set_default, #store, #sub_registry, #to_a, #to_hash, #values
Constructor Details
Returns a new instance of TokyoCabinetAccessor
18
19
20
|
# File '/home/apoc/projects/ruby/rbot/lib/rbot/registry/tc.rb', line 18
def initialize(filename)
super filename + '.tdb'
end
|
Instance Method Details
- (Object) delete(key)
44
45
46
47
48
49
|
# File '/home/apoc/projects/ruby/rbot/lib/rbot/registry/tc.rb', line 44
def delete(key)
return default unless dbexists?
value = self[key]
registry.delete(key.to_s)
value end
|
34
35
36
37
|
# File '/home/apoc/projects/ruby/rbot/lib/rbot/registry/tc.rb', line 34
def flush
return unless @registry
@registry.sync
end
|
- (Object) optimize
39
40
41
42
|
# File '/home/apoc/projects/ruby/rbot/lib/rbot/registry/tc.rb', line 39
def optimize
return unless @registry
@registry.optimize
end
|
- (Object) registry
22
23
24
25
26
27
28
29
30
31
32
|
# File '/home/apoc/projects/ruby/rbot/lib/rbot/registry/tc.rb', line 22
def registry
super
unless @registry
@registry = TokyoCabinet::BDB.new
@registry.open(@filename,
TokyoCabinet::BDB::OREADER |
TokyoCabinet::BDB::OCREAT |
TokyoCabinet::BDB::OWRITER)
end
@registry
end
|