Class: Java::NetSfEhcache::CacheManager
- Inherits:
-
Object
- Object
- Java::NetSfEhcache::CacheManager
- Includes:
- Enumerable
- Defined in:
- lib/ehcache/cache_manager.rb
Overview
Enhance net.sf.ehcache.CacheManager with a more Rubyesque API.
Class Method Summary collapse
-
.create(*args) ⇒ Object
Enhanced create that provides for some extra configuration options.
- .ehcache_create ⇒ Object
Instance Method Summary collapse
- #cache(cache_name = '__default_jruby_cache') ⇒ Object
-
#each ⇒ Object
Iterate through each cache managed by this CacheManager.
-
#include?(cache_name) ⇒ Boolean
(also: #exists?)
true if cache by given name is being managed, false otherwise.
-
#initialize(*args) ⇒ CacheManager
constructor
Enhanced constructor that provides for some extra configuration options.
Constructor Details
#initialize(*args) ⇒ CacheManager
Enhanced constructor that provides for some extra configuration options. Specifically, String arguments may be used where native Ehcache expects java.io.File objects, and if the String refers to a YAML file it will be used as the Configuration source.
23 24 25 26 27 |
# File 'lib/ehcache/cache_manager.rb', line 23 def initialize(*args) process_init_args(*args) do |*args| super(*args) end end |
Class Method Details
.create(*args) ⇒ Object
Enhanced create that provides for some extra configuration options. Specifically, String arguments may be used where native Ehcache expects java.io.File objects, and if the String refers to a YAML file it will be used as the Configuration source.
12 13 14 15 16 |
# File 'lib/ehcache/cache_manager.rb', line 12 def create(*args) process_init_args(*args) do |*args| ehcache_create(*args) end end |
.ehcache_create ⇒ Object
6 |
# File 'lib/ehcache/cache_manager.rb', line 6 alias_method :ehcache_create, :create |
Instance Method Details
#cache(cache_name = '__default_jruby_cache') ⇒ Object
38 39 40 41 |
# File 'lib/ehcache/cache_manager.rb', line 38 def cache(cache_name = '__default_jruby_cache') self.add_cache_if_absent(cache_name) self.get_ehcache(cache_name) end |
#each ⇒ Object
Iterate through each cache managed by this CacheManager.
30 31 32 33 34 |
# File 'lib/ehcache/cache_manager.rb', line 30 def each for name in self.cache_names yield self.get_ehcache(name) end end |
#include?(cache_name) ⇒ Boolean Also known as: exists?
true if cache by given name is being managed, false otherwise
44 45 46 |
# File 'lib/ehcache/cache_manager.rb', line 44 def include?(cache_name) self.cache_exists(cache_name) end |