Class: Moneta::File::Expiration

Inherits:
Object
  • Object
show all
Defined in:
lib/moneta/file.rb

Instance Method Summary collapse

Constructor Details

#initialize(directory) ⇒ Expiration

Returns a new instance of Expiration.



12
13
14
# File 'lib/moneta/file.rb', line 12

def initialize(directory)
  @directory = directory
end

Instance Method Details

#[](key) ⇒ Object



16
17
18
19
20
# File 'lib/moneta/file.rb', line 16

def [](key)
  attrs = xattr(key)
  ret = Marshal.load(attrs.get("moneta_expires"))
rescue Errno::ENOENT, SystemCallError
end

#[]=(key, value) ⇒ Object



22
23
24
25
# File 'lib/moneta/file.rb', line 22

def []=(key, value)
  attrs = xattr(key)
  attrs.set("moneta_expires", Marshal.dump(value))
end

#delete(key) ⇒ Object



27
28
29
30
# File 'lib/moneta/file.rb', line 27

def delete(key)
  attrs = xattr(key)
  attrs.remove("moneta_expires")
end