Class: ODB::FileStore
Instance Attribute Summary
Attributes inherited from DataStore
Instance Method Summary collapse
- #after_commit ⇒ Object
-
#initialize(name) ⇒ FileStore
constructor
A new instance of FileStore.
Methods inherited from DataStore
Constructor Details
#initialize(name) ⇒ FileStore
Returns a new instance of FileStore.
113 114 115 116 117 118 119 |
# File 'lib/odb.rb', line 113 def initialize(name) super(name) FileUtils.mkdir_p(name) if File.file?(resource("__key_cache")) @key_cache = Marshal.load(IO.read(resource("__key_cache"))) end end |
Instance Method Details
#after_commit ⇒ Object
121 122 123 124 125 |
# File 'lib/odb.rb', line 121 def after_commit File.open(resource("__key_cache"), "wb") do |file| file.write(Marshal.dump(key_cache)) end end |