Class: ActiveSupport::Cache::JcacheStore
- Inherits:
-
Store
- Object
- Store
- ActiveSupport::Cache::JcacheStore
- Defined in:
- lib/jcache_store.rb,
lib/active_support/cache/jcache_store.rb
Defined Under Namespace
Classes: JcacheError
Constant Summary collapse
- VERSION =
'0.1.0'
Instance Method Summary collapse
- #clear ⇒ Object
- #delete(key, options = nil) ⇒ Object
- #delete_matched(matcher, options = nil) ⇒ Object
- #exist?(key, options = nil) ⇒ Boolean
-
#initialize(options = {}) ⇒ JcacheStore
constructor
A new instance of JcacheStore.
- #keys ⇒ Object
- #read(key, options = nil) ⇒ Object
- #write(key, value, options = {}) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ JcacheStore
Returns a new instance of JcacheStore.
13 14 15 16 |
# File 'lib/active_support/cache/jcache_store.rb', line 13 def initialize( = {}) cacheFactory = CacheManager.get_instance.get_cache_factory; @data = cacheFactory.create_cache(Collections.empty_map); end |
Instance Method Details
#clear ⇒ Object
56 57 58 59 60 61 62 |
# File 'lib/active_support/cache/jcache_store.rb', line 56 def clear @data.clear true rescue CacheException => e logger.error("JcacheError (#{e}): #{e.}") false end |
#delete(key, options = nil) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/active_support/cache/jcache_store.rb', line 35 def delete(key, = nil) super @data.remove(key) rescue CacheException => e logger.error("JcacheError (#{e}): #{e.}") false end |
#delete_matched(matcher, options = nil) ⇒ Object
51 52 53 54 |
# File 'lib/active_support/cache/jcache_store.rb', line 51 def delete_matched(matcher, = nil) super raise "Not supported by Ehcache" end |
#exist?(key, options = nil) ⇒ Boolean
47 48 49 |
# File 'lib/active_support/cache/jcache_store.rb', line 47 def exist?(key, = nil) @data.contains_key(key) end |
#keys ⇒ Object
43 44 45 |
# File 'lib/active_support/cache/jcache_store.rb', line 43 def keys @data.key_set.to_a end |
#read(key, options = nil) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/active_support/cache/jcache_store.rb', line 18 def read(key, = nil) super @data.get(key) rescue CacheException => e logger.error("JcacheError (#{e}): #{e.}") false end |
#write(key, value, options = {}) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/active_support/cache/jcache_store.rb', line 26 def write(key, value, = {}) super @data.put(key, value) true rescue CacheException => e logger.error("JcacheError (#{e}): #{e.}") false end |