Class: RubyBeans::Cache

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_beans/cache.rb

Constant Summary collapse

@@_hash =
Hash.new

Class Method Summary collapse

Class Method Details

.get(name) ⇒ Object



6
7
8
# File 'lib/ruby_beans/cache.rb', line 6

def get(name)
  @@_hash[name]
end

.get_or_put(name, obj) ⇒ Object



14
15
16
17
18
19
# File 'lib/ruby_beans/cache.rb', line 14

def get_or_put(name, obj)
  unless get(name)
    put(name, obj)
  end
  get(name)
end

.hashObject



21
22
23
# File 'lib/ruby_beans/cache.rb', line 21

def hash
  @@_hash
end

.put(name, obj) ⇒ Object



10
11
12
# File 'lib/ruby_beans/cache.rb', line 10

def put(name, obj)
  @@_hash[name] = obj
end