Class: ActiveSupport::Cache::HazelcastCacheStore

Inherits:
Store
  • Object
show all
Defined in:
lib/jruby-hazelcast-store.rb

Defined Under Namespace

Classes: CacheException

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ HazelcastCacheStore

Returns a new instance of HazelcastCacheStore.



13
14
15
16
17
18
# File 'lib/jruby-hazelcast-store.rb', line 13

def initialize(options = {})
  @cache = HazelcastCacheClient.instance
  rescue CacheException => e
    logger.error("HazelcastCacheStore Creation Error (#{e}): #{e.message}")
  
end

Instance Method Details

#clearObject



57
58
59
60
61
62
63
# File 'lib/jruby-hazelcast-store.rb', line 57

def clear
   @data.clear
   true
   rescue CacheException => e
     logger.error("HazelcastCacheStore Creation Error (#{e}): #{e.message}")
   
end

#delete_entry(key, options = nil) ⇒ Object



35
36
37
38
39
40
# File 'lib/jruby-hazelcast-store.rb', line 35

def delete_entry(key, options = nil)
  @data.evict(key)
  rescue CacheException => e
    logger.error("HazelcastCacheStore Creation Error (#{e}): #{e.message}")
  
end

#delete_matched(matcher, options = nil) ⇒ Object



53
54
55
# File 'lib/jruby-hazelcast-store.rb', line 53

def delete_matched(matcher, options = nil)
  raise "Not supported by HazelcastCacheClient"
end

#exist?(key, options = nil) ⇒ Boolean

Returns:

  • (Boolean)


46
47
48
49
50
51
# File 'lib/jruby-hazelcast-store.rb', line 46

def exist?(key, options = nil)
  @data.exist?(key)
  rescue CacheException => e
    logger.error("HazelcastCacheStore Creation Error (#{e}): #{e.message}")
  
end

#keysObject



42
43
44
# File 'lib/jruby-hazelcast-store.rb', line 42

def keys
  raise "Not supported by HazelcastCacheClient"
end

#read_entry(key, options = nil) ⇒ Object



20
21
22
23
24
25
# File 'lib/jruby-hazelcast-store.rb', line 20

def read_entry(key, options = nil)
  @cache.get(key)
  rescue CacheException => e
    logger.error("HazelcastCacheStore Creation Error (#{e}): #{e.message}")
  
end

#write_entry(key, value, options = nil) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/jruby-hazelcast-store.rb', line 27

def write_entry(key, value, options = nil)
  @data.put(key, value, options)
  true
  rescue CacheException => e
    logger.error("HazelcastCacheStore Creation Error (#{e}): #{e.message}")
  
end