lib/pseudocephalopod/memory_cache.rb in pseudocephalopod-0.1.0 vs lib/pseudocephalopod/memory_cache.rb in pseudocephalopod-0.2.0
- old
+ new
@@ -1,19 +1,25 @@
module Pseudocephalopod
class MemoryCache
- @@cache = {}
-
- def self.write(key, value)
- @@cache[key.to_s] = value
+ def self.write(key, value, options = {})
+ cache[key.to_s] = value
end
def self.read(key)
- @@cache[key.to_s]
+ cache[key.to_s]
end
+ def self.delete(key)
+ cache.delete key.to_s
+ end
+
def self.reset!
- @@cache = {}
+ @cache = nil
+ end
+
+ def self.cache
+ @cache ||= {}
end
end
end
\ No newline at end of file