Class: GroovyOneliner::Cache

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

Instance Method Summary collapse

Constructor Details

#initializeCache

Returns a new instance of Cache.



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

def initialize
  @cache = {}
end

Instance Method Details

#[](key) ⇒ Object



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

def [](key)
  @cache[key]
end

#[]=(key, value) ⇒ Object



14
15
16
# File 'lib/groovy_oneliner/cache.rb', line 14

def []=(key, value)
  @cache[key] = value
end

#reset!Object



18
19
20
# File 'lib/groovy_oneliner/cache.rb', line 18

def reset!
  @cache = {}
end