2008-05-18 06:22:34 +02:00
|
|
|
module ActiveSupport
|
|
|
|
module Cache
|
|
|
|
class MemoryStore < Store
|
|
|
|
def initialize
|
|
|
|
@data = {}
|
|
|
|
end
|
|
|
|
|
|
|
|
def read(name, options = nil)
|
|
|
|
super
|
|
|
|
@data[name]
|
|
|
|
end
|
|
|
|
|
|
|
|
def write(name, value, options = nil)
|
|
|
|
super
|
|
|
|
@data[name] = value
|
|
|
|
end
|
|
|
|
|
|
|
|
def delete(name, options = nil)
|
|
|
|
super
|
|
|
|
@data.delete(name)
|
|
|
|
end
|
|
|
|
|
|
|
|
def delete_matched(matcher, options = nil)
|
|
|
|
super
|
|
|
|
@data.delete_if { |k,v| k =~ matcher }
|
|
|
|
end
|
2008-06-02 08:35:38 +02:00
|
|
|
|
|
|
|
def exist?(name,options = nil)
|
|
|
|
super
|
|
|
|
@data.has_key?(name)
|
|
|
|
end
|
|
|
|
|
2008-05-18 06:22:34 +02:00
|
|
|
def clear
|
|
|
|
@data.clear
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|