A cache backed in memory.

Methods
Attributes
[R] hash
Public Class methods
new(options = {})
    # File lib/glue/cache/memory.rb, line 15
15:   def initialize(options = {})
16:     if options[:sync]
17:       @hash = SyncHash
18:     else
19:       @hash = {}
20:     end
21:   end
Public Instance methods
[](key, options = nil)

Alias for #get

[]=(key, value = nil, options = nil)

Alias for #set

all()

Return all objects in the cache.

This method is also aliased as values
    # File lib/glue/cache/memory.rb, line 72
72:   def all
73:     @hash.values
74:   end
delete(key, options = nil)

Delete an object from the cache.

This method is also aliased as remove
    # File lib/glue/cache/memory.rb, line 42
42:   def delete(key, options = nil) 
43:     @hash.delete(key)
44:   end
delete_if(&block)
    # File lib/glue/cache/memory.rb, line 47
47:   def delete_if(&block)
48:     @hash.delete_if(&block)
49:   end
gc!()

Perform session garbage collection. Typically this method is called from a cron like mechanism.

    # File lib/glue/cache/memory.rb, line 54
54:   def gc!
55:     delete_if { |key, s| s.expired? }
56:   end
get(key, options = nil)

Get an object from the cache.

This method is also aliased as read []
    # File lib/glue/cache/memory.rb, line 25
25:   def get(key, options = nil)
26:     @hash[key]
27:   end
keys()

Return all keys in the cache.

    # File lib/glue/cache/memory.rb, line 66
66:   def keys
67:     @hash.keys
68:   end
mapping()

Return the mapping.

    # File lib/glue/cache/memory.rb, line 60
60:   def mapping
61:     @hash
62:   end
put(key, value = nil, options = nil)

Alias for #set

read(key, options = nil)

Alias for #get

remove(key, options = nil)

Alias for #delete

set(key, value = nil, options = nil)

Put an object in the cache.

This method is also aliased as put write []=
    # File lib/glue/cache/memory.rb, line 33
33:   def set(key, value = nil, options = nil)
34:     @hash[key] = value
35:   end
values()

Alias for #all

write(key, value = nil, options = nil)

Alias for #set