Class: Jerakia::Cache

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

Overview

Very primitive form of cache - but we'll make this smarter

Direct Known Subclasses

Datasource

Instance Method Summary collapse

Constructor Details

#initialize ⇒ Cache

Returns a new instance of Cache.



7
8
9
# File 'lib/jerakia/cache.rb', line 7

def initialize
  @@bucket = {}
end

Instance Method Details

#bucket ⇒ Object



20
21
22
# File 'lib/jerakia/cache.rb', line 20

def bucket
  @@bucket
end

#bucket_add(index, data) ⇒ Object



11
12
13
14
# File 'lib/jerakia/cache.rb', line 11

def bucket_add(index,data)
  @@bucket[index] = data
  data
end

#in_bucket?(index) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/jerakia/cache.rb', line 16

def in_bucket?(index)
  @@bucket.has_key?(index)
end