jruby-ehcache 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +2 -0
- data/Gemfile.lock +2 -14
- data/README.txt +9 -0
- data/Rakefile +13 -62
- data/VERSION +1 -1
- data/ext/marshaled-ruby-object.jar +0 -0
- data/jruby-ehcache-rails2.gemspec +14 -46
- data/jruby-ehcache-rails3.gemspec +14 -46
- data/jruby-ehcache.gemspec +9 -102
- data/lib/active_support/cache/ehcache_store.rb +66 -0
- data/lib/active_support/ehcache_store.rb +59 -0
- data/lib/ehcache.rb +0 -27
- data/lib/ehcache/active_support_store.rb +58 -0
- data/lib/ehcache/cache.rb +11 -1
- data/lib/ehcache/element.rb +12 -0
- data/lib/ehcache/version.rb +3 -0
- data/src/net/sf/ehcache/MarshaledRubyObject.java +15 -0
- metadata +114 -211
- data/lib/ehcache/extensions.rb +0 -31
data/.gitignore
ADDED
data/Gemfile.lock
CHANGED
@@ -1,29 +1,17 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
jruby-ehcache (1.2.
|
5
|
-
activesupport
|
4
|
+
jruby-ehcache (1.2.1)
|
6
5
|
i18n
|
7
|
-
jruby-ehcache
|
8
6
|
|
9
7
|
GEM
|
10
8
|
remote: http://rubygems.org/
|
11
9
|
specs:
|
12
|
-
activesupport (3.1.1)
|
13
|
-
multi_json (~> 1.0)
|
14
|
-
git (1.2.5)
|
15
10
|
i18n (0.6.0)
|
16
|
-
jeweler (1.6.4)
|
17
|
-
bundler (~> 1.0)
|
18
|
-
git (>= 1.2.5)
|
19
|
-
rake
|
20
|
-
multi_json (1.0.3)
|
21
|
-
rake (0.8.7)
|
22
11
|
|
23
12
|
PLATFORMS
|
24
13
|
java
|
14
|
+
ruby
|
25
15
|
|
26
16
|
DEPENDENCIES
|
27
|
-
jeweler
|
28
17
|
jruby-ehcache!
|
29
|
-
rake
|
data/README.txt
CHANGED
@@ -51,6 +51,15 @@ OR
|
|
51
51
|
$ jruby -S gem install jruby-ehcache-rails3
|
52
52
|
|
53
53
|
|
54
|
+
== GEMFILE:
|
55
|
+
|
56
|
+
Add the gem as you normally would in your Gemfile, making sure to require
|
57
|
+
'ehcache' explicitly. Here is an example of adding the rails3 gem to a Gemfile.
|
58
|
+
|
59
|
+
gem 'jruby-ehcache-rails3', :require => 'ehcache'
|
60
|
+
|
61
|
+
|
62
|
+
|
54
63
|
== REQUIREMENTS:
|
55
64
|
|
56
65
|
Tested with JRuby 1.5.3.
|
data/Rakefile
CHANGED
@@ -1,62 +1,13 @@
|
|
1
|
-
require
|
2
|
-
|
3
|
-
|
4
|
-
task :default => [ :test ]
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
t.
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
require 'jeweler'
|
15
|
-
rescue LoadError
|
16
|
-
puts "Jeweler not available. Install it with: gem install jeweler"
|
17
|
-
end
|
18
|
-
|
19
|
-
def defaults(gemspec)
|
20
|
-
gemspec.rubyforge_project = 'ehcache'
|
21
|
-
gemspec.homepage = "http://ehcache.rubyforge.org"
|
22
|
-
gemspec.authors = ["Dylan Stamat", "Jason Voegele"]
|
23
|
-
gemspec.email = ['dstamat@elctech.com', 'jvoegele@terracotta.org']
|
24
|
-
end
|
25
|
-
|
26
|
-
Jeweler::Tasks.new do |gemspec|
|
27
|
-
defaults(gemspec)
|
28
|
-
gemspec.name = "jruby-ehcache"
|
29
|
-
gemspec.summary = "JRuby interface to Ehcache"
|
30
|
-
gemspec.description = "JRuby interface to the popular Java caching library Ehcache"
|
31
|
-
gemspec.files.exclude '.gitignore'
|
32
|
-
|
33
|
-
# These files go in the jruby-ehcache-rails2 and jruby-ehcache-rails3 gems
|
34
|
-
gemspec.files.exclude 'lib/active_support/**/*'
|
35
|
-
gemspec.files.exclude 'lib/ehcache/active_support_store.rb'
|
36
|
-
gemspec.add_dependency 'activesupport'
|
37
|
-
gemspec.add_dependency 'i18n' # activesupport 'requires' this but not in a bundler friendly way
|
38
|
-
gemspec.add_development_dependency 'rake'
|
39
|
-
gemspec.add_development_dependency 'jeweler'
|
40
|
-
end
|
41
|
-
|
42
|
-
Jeweler::Tasks.new do |gemspec|
|
43
|
-
defaults(gemspec)
|
44
|
-
gemspec.name = 'jruby-ehcache-rails3'
|
45
|
-
gemspec.summary = 'Rails 3 cache store provider using Ehcache'
|
46
|
-
gemspec.description = 'Rails 3 cache store provider using Ehcache'
|
47
|
-
gemspec.files = FileList['lib/active_support/**/*', 'lib/ehcache/active_support_store.rb']
|
48
|
-
gemspec.test_files = []
|
49
|
-
gemspec.add_dependency 'jruby-ehcache', ">=1.2.0"
|
50
|
-
end
|
51
|
-
|
52
|
-
Jeweler::Tasks.new do |gemspec|
|
53
|
-
defaults(gemspec)
|
54
|
-
gemspec.name = 'jruby-ehcache-rails2'
|
55
|
-
gemspec.summary = 'Rails 2 cache store provider using Ehcache'
|
56
|
-
gemspec.description = 'Rails 2 cache store provider using Ehcache'
|
57
|
-
gemspec.files = FileList['lib/active_support/**/*', 'lib/ehcache/active_support_store.rb']
|
58
|
-
gemspec.test_files = []
|
59
|
-
gemspec.add_dependency 'jruby-ehcache', ">=1.2.0"
|
60
|
-
end
|
61
|
-
|
62
|
-
Jeweler::GemcutterTasks.new
|
1
|
+
require "bundler/gem_helper"
|
2
|
+
Bundler::GemHelper.install_tasks :name => "jruby-ehcache"
|
3
|
+
|
4
|
+
task :default => [ :test ]
|
5
|
+
|
6
|
+
require 'rdoc/task'
|
7
|
+
require 'rake/testtask'
|
8
|
+
desc "Executes the test suite"
|
9
|
+
Rake::TestTask.new do |t|
|
10
|
+
t.name = :test
|
11
|
+
t.libs << 'lib' << 'ext' << 'test'
|
12
|
+
t.pattern = "test/test_*.rb"
|
13
|
+
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.2.
|
1
|
+
1.2.1
|
Binary file
|
@@ -1,60 +1,28 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "ehcache/version"
|
5
4
|
|
6
5
|
Gem::Specification.new do |s|
|
7
6
|
s.name = %q{jruby-ehcache-rails2}
|
8
|
-
s.version =
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
7
|
+
s.version = Ehcache::VERSION
|
11
8
|
s.authors = [%q{Dylan Stamat}, %q{Jason Voegele}]
|
12
9
|
s.date = %q{2012-03-14}
|
13
|
-
s.description = %q{
|
10
|
+
s.description = %q{The Ehcache cache store provider for Rails 2}
|
14
11
|
s.email = [%q{dstamat@elctech.com}, %q{jvoegele@terracotta.org}]
|
15
|
-
s.
|
16
|
-
s.extra_rdoc_files = [
|
17
|
-
"README.txt"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
"lib/active_support/cache/ehcache_store.rb",
|
21
|
-
"lib/active_support/ehcache_store.rb",
|
22
|
-
"lib/ehcache/active_support_store.rb"
|
23
|
-
]
|
12
|
+
s.extra_rdoc_files = [ "README.txt" ]
|
24
13
|
s.homepage = %q{http://ehcache.rubyforge.org}
|
25
|
-
s.require_paths = [%q{lib}]
|
26
14
|
s.rubyforge_project = %q{ehcache}
|
27
15
|
s.rubygems_version = %q{1.8.9}
|
28
16
|
s.summary = %q{Rails 2 cache store provider using Ehcache}
|
29
17
|
|
30
|
-
|
31
|
-
|
18
|
+
s.files = `git ls-files`.split("\n").concat(
|
19
|
+
["lib/active_support/ehcache_store.rb",
|
20
|
+
"lib/ehcache/active_support_store.rb"])
|
32
21
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
s.add_development_dependency(%q<rake>, [">= 0"])
|
37
|
-
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
38
|
-
s.add_development_dependency(%q<rake>, [">= 0"])
|
39
|
-
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
40
|
-
s.add_runtime_dependency(%q<jruby-ehcache>, [">= 1.2.0"])
|
41
|
-
else
|
42
|
-
s.add_dependency(%q<jruby-ehcache>, [">= 1.2.0"])
|
43
|
-
s.add_dependency(%q<jruby-ehcache>, [">= 0"])
|
44
|
-
s.add_dependency(%q<rake>, [">= 0"])
|
45
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
46
|
-
s.add_dependency(%q<rake>, [">= 0"])
|
47
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
48
|
-
s.add_dependency(%q<jruby-ehcache>, [">= 1.2.0"])
|
49
|
-
end
|
50
|
-
else
|
51
|
-
s.add_dependency(%q<jruby-ehcache>, [">= 1.2.0"])
|
52
|
-
s.add_dependency(%q<jruby-ehcache>, [">= 0"])
|
53
|
-
s.add_dependency(%q<rake>, [">= 0"])
|
54
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
55
|
-
s.add_dependency(%q<rake>, [">= 0"])
|
56
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
57
|
-
s.add_dependency(%q<jruby-ehcache>, [">= 1.2.0"])
|
58
|
-
end
|
59
|
-
end
|
22
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
23
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
24
|
+
s.require_paths = ["lib"]
|
60
25
|
|
26
|
+
s.add_runtime_dependency "i18n"
|
27
|
+
s.add_runtime_dependency "jruby-ehcache"
|
28
|
+
end
|
@@ -1,60 +1,28 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "ehcache/version"
|
5
4
|
|
6
5
|
Gem::Specification.new do |s|
|
7
6
|
s.name = %q{jruby-ehcache-rails3}
|
8
|
-
s.version =
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
7
|
+
s.version = Ehcache::VERSION
|
11
8
|
s.authors = [%q{Dylan Stamat}, %q{Jason Voegele}]
|
12
9
|
s.date = %q{2012-03-14}
|
13
|
-
s.description = %q{
|
10
|
+
s.description = %q{The Ehcache cache store provider for Rails 3}
|
14
11
|
s.email = [%q{dstamat@elctech.com}, %q{jvoegele@terracotta.org}]
|
15
|
-
s.
|
16
|
-
s.extra_rdoc_files = [
|
17
|
-
"README.txt"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
"lib/active_support/cache/ehcache_store.rb",
|
21
|
-
"lib/active_support/ehcache_store.rb",
|
22
|
-
"lib/ehcache/active_support_store.rb"
|
23
|
-
]
|
12
|
+
s.extra_rdoc_files = [ "README.txt" ]
|
24
13
|
s.homepage = %q{http://ehcache.rubyforge.org}
|
25
|
-
s.require_paths = [%q{lib}]
|
26
14
|
s.rubyforge_project = %q{ehcache}
|
27
15
|
s.rubygems_version = %q{1.8.9}
|
28
16
|
s.summary = %q{Rails 3 cache store provider using Ehcache}
|
29
17
|
|
30
|
-
|
31
|
-
|
18
|
+
s.files = `git ls-files`.split("\n").concat(
|
19
|
+
["lib/active_support/cache/ehcache_store.rb",
|
20
|
+
"lib/ehcache/active_support_store.rb"])
|
32
21
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
s.add_development_dependency(%q<rake>, [">= 0"])
|
37
|
-
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
38
|
-
s.add_development_dependency(%q<rake>, [">= 0"])
|
39
|
-
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
40
|
-
s.add_runtime_dependency(%q<jruby-ehcache>, [">= 1.2.0"])
|
41
|
-
else
|
42
|
-
s.add_dependency(%q<jruby-ehcache>, [">= 1.2.0"])
|
43
|
-
s.add_dependency(%q<jruby-ehcache>, [">= 0"])
|
44
|
-
s.add_dependency(%q<rake>, [">= 0"])
|
45
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
46
|
-
s.add_dependency(%q<rake>, [">= 0"])
|
47
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
48
|
-
s.add_dependency(%q<jruby-ehcache>, [">= 1.2.0"])
|
49
|
-
end
|
50
|
-
else
|
51
|
-
s.add_dependency(%q<jruby-ehcache>, [">= 1.2.0"])
|
52
|
-
s.add_dependency(%q<jruby-ehcache>, [">= 0"])
|
53
|
-
s.add_dependency(%q<rake>, [">= 0"])
|
54
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
55
|
-
s.add_dependency(%q<rake>, [">= 0"])
|
56
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
57
|
-
s.add_dependency(%q<jruby-ehcache>, [">= 1.2.0"])
|
58
|
-
end
|
59
|
-
end
|
22
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
23
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
24
|
+
s.require_paths = ["lib"]
|
60
25
|
|
26
|
+
s.add_runtime_dependency "i18n"
|
27
|
+
s.add_runtime_dependency "jruby-ehcache"
|
28
|
+
end
|
data/jruby-ehcache.gemspec
CHANGED
@@ -1,117 +1,24 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "ehcache/version"
|
5
4
|
|
6
5
|
Gem::Specification.new do |s|
|
7
6
|
s.name = %q{jruby-ehcache}
|
8
|
-
s.version =
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
7
|
+
s.version = Ehcache::VERSION
|
11
8
|
s.authors = [%q{Dylan Stamat}, %q{Jason Voegele}]
|
12
9
|
s.date = %q{2012-03-14}
|
13
10
|
s.description = %q{JRuby interface to the popular Java caching library Ehcache}
|
14
11
|
s.email = [%q{dstamat@elctech.com}, %q{jvoegele@terracotta.org}]
|
15
|
-
s.
|
16
|
-
s.extra_rdoc_files = [
|
17
|
-
"README.txt"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
"Gemfile",
|
21
|
-
"Gemfile.lock",
|
22
|
-
"History.txt",
|
23
|
-
"License.txt",
|
24
|
-
"Manifest.txt",
|
25
|
-
"PostInstall.txt",
|
26
|
-
"README.txt",
|
27
|
-
"Rakefile",
|
28
|
-
"VERSION",
|
29
|
-
"bin/ehcache",
|
30
|
-
"config/ehcache.yml",
|
31
|
-
"config/ehcache_manual_rmi.yml",
|
32
|
-
"examples/ehcache.xml",
|
33
|
-
"examples/jruby-ehcache.rb",
|
34
|
-
"ext/ehcache-2.4.6/ehcache-core-2.4.6.jar",
|
35
|
-
"ext/ehcache-2.4.6/ehcache-terracotta-2.4.6.jar",
|
36
|
-
"ext/ehcache-2.4.6/slf4j-api-1.6.1.jar",
|
37
|
-
"ext/ehcache-2.4.6/slf4j-jdk14-1.6.1.jar",
|
38
|
-
"ext/ehcache-2.4.6/terracotta-toolkit-1.3-runtime-3.3.0.jar",
|
39
|
-
"jruby-ehcache-rails2.gemspec",
|
40
|
-
"jruby-ehcache-rails3.gemspec",
|
41
|
-
"jruby-ehcache.gemspec",
|
42
|
-
"lib/ehcache.rb",
|
43
|
-
"lib/ehcache/cache.rb",
|
44
|
-
"lib/ehcache/cache_manager.rb",
|
45
|
-
"lib/ehcache/config.rb",
|
46
|
-
"lib/ehcache/element.rb",
|
47
|
-
"lib/ehcache/extensions.rb",
|
48
|
-
"lib/ehcache/java.rb",
|
49
|
-
"lib/ehcache/yaml_config.rb",
|
50
|
-
"script/console",
|
51
|
-
"script/destroy",
|
52
|
-
"script/generate",
|
53
|
-
"script/txt2html",
|
54
|
-
"spec/cache_manager_spec.rb",
|
55
|
-
"spec/cache_spec.rb",
|
56
|
-
"spec/spec.opts",
|
57
|
-
"spec/spec_helper.rb",
|
58
|
-
"tasks/deployment.rake",
|
59
|
-
"tasks/environment.rake",
|
60
|
-
"tasks/website.rake",
|
61
|
-
"test/ehcache.xml",
|
62
|
-
"test/ehcache.yml",
|
63
|
-
"test/test_cache.rb",
|
64
|
-
"test/test_cache_manager.rb",
|
65
|
-
"test/test_configuration.rb",
|
66
|
-
"test/test_ehcache.rb",
|
67
|
-
"test/test_element.rb",
|
68
|
-
"test/test_helper.rb",
|
69
|
-
"test/test_yaml_config.rb",
|
70
|
-
"website/index.html",
|
71
|
-
"website/javascripts/rounded_corners_lite.inc.js",
|
72
|
-
"website/stylesheets/screen.css",
|
73
|
-
"website/template.html.erb"
|
74
|
-
]
|
12
|
+
s.extra_rdoc_files = [ "README.txt" ]
|
75
13
|
s.homepage = %q{http://ehcache.rubyforge.org}
|
76
|
-
s.require_paths = [%q{lib}]
|
77
14
|
s.rubyforge_project = %q{ehcache}
|
78
15
|
s.rubygems_version = %q{1.8.9}
|
79
16
|
s.summary = %q{JRuby interface to Ehcache}
|
80
17
|
|
81
|
-
|
82
|
-
|
18
|
+
s.files = `git ls-files`.split("\n")
|
19
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
20
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
21
|
+
s.require_paths = ["lib"]
|
83
22
|
|
84
|
-
|
85
|
-
s.add_runtime_dependency(%q<jruby-ehcache>, [">= 0"])
|
86
|
-
s.add_development_dependency(%q<rake>, [">= 0"])
|
87
|
-
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
88
|
-
s.add_development_dependency(%q<rake>, [">= 0"])
|
89
|
-
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
90
|
-
s.add_runtime_dependency(%q<activesupport>, [">= 0"])
|
91
|
-
s.add_runtime_dependency(%q<i18n>, [">= 0"])
|
92
|
-
s.add_development_dependency(%q<rake>, [">= 0"])
|
93
|
-
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
94
|
-
else
|
95
|
-
s.add_dependency(%q<jruby-ehcache>, [">= 0"])
|
96
|
-
s.add_dependency(%q<rake>, [">= 0"])
|
97
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
98
|
-
s.add_dependency(%q<rake>, [">= 0"])
|
99
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
100
|
-
s.add_dependency(%q<activesupport>, [">= 0"])
|
101
|
-
s.add_dependency(%q<i18n>, [">= 0"])
|
102
|
-
s.add_dependency(%q<rake>, [">= 0"])
|
103
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
104
|
-
end
|
105
|
-
else
|
106
|
-
s.add_dependency(%q<jruby-ehcache>, [">= 0"])
|
107
|
-
s.add_dependency(%q<rake>, [">= 0"])
|
108
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
109
|
-
s.add_dependency(%q<rake>, [">= 0"])
|
110
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
111
|
-
s.add_dependency(%q<activesupport>, [">= 0"])
|
112
|
-
s.add_dependency(%q<i18n>, [">= 0"])
|
113
|
-
s.add_dependency(%q<rake>, [">= 0"])
|
114
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
115
|
-
end
|
23
|
+
s.add_runtime_dependency "i18n"
|
116
24
|
end
|
117
|
-
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'ehcache/active_support_store'
|
2
|
+
|
3
|
+
# Rails 3 cache store implementation which stores data in Ehcache:
|
4
|
+
# http://www.ehcache.org/
|
5
|
+
|
6
|
+
module ActiveSupport
|
7
|
+
module Cache
|
8
|
+
class EhcacheStore < Ehcache::ActiveSupportStore
|
9
|
+
|
10
|
+
def initialize(*args)
|
11
|
+
args = args.flatten
|
12
|
+
options = args.extract_options!
|
13
|
+
super(options)
|
14
|
+
self.create_cache_manager(options)
|
15
|
+
@ehcache = self.create_cache(options)
|
16
|
+
extend Strategy::LocalCache
|
17
|
+
end
|
18
|
+
|
19
|
+
def increment(name, amount = 1, options = nil) # :nodoc:
|
20
|
+
@ehcache.compare_and_swap(name) { |current_value|
|
21
|
+
current_value + amount
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
def decrement(name, amount = 1, options = nil) # :nodoc:
|
26
|
+
@ehcache.compare_and_swap(name) { |current_value|
|
27
|
+
current_value - amount
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
def clear(options = nil)
|
32
|
+
@ehcache.remove_all
|
33
|
+
end
|
34
|
+
|
35
|
+
def stats
|
36
|
+
@ehcache.statistics
|
37
|
+
end
|
38
|
+
|
39
|
+
protected
|
40
|
+
# Read an entry from the cache.
|
41
|
+
def read_entry(key, options) # :nodoc:
|
42
|
+
@ehcache[key]
|
43
|
+
rescue Ehcache::EhcacheError => e
|
44
|
+
logger.error("EhcacheError (#{e}): #{e.message}")
|
45
|
+
false
|
46
|
+
end
|
47
|
+
|
48
|
+
# Write an entry to the cache.
|
49
|
+
def write_entry(key, entry, options) # :nodoc:
|
50
|
+
@ehcache.put(key, entry, options)
|
51
|
+
true
|
52
|
+
rescue Ehcache::EhcacheError => e
|
53
|
+
logger.error("EhcacheError (#{e}): #{e.message}")
|
54
|
+
false
|
55
|
+
end
|
56
|
+
|
57
|
+
# Delete an entry from the cache.
|
58
|
+
def delete_entry(key, options) # :nodoc:
|
59
|
+
@ehcache.remove(key)
|
60
|
+
rescue Exception => e
|
61
|
+
logger.error("EhcacheError (#{e}): #{e.message}")
|
62
|
+
false
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'ehcache/active_support_store'
|
2
|
+
|
3
|
+
# Rails 2 cache store implementation which stores data in Ehcache:
|
4
|
+
# http://www.ehcache.org/
|
5
|
+
|
6
|
+
module ActiveSupport
|
7
|
+
module Cache
|
8
|
+
class EhcacheStore < Ehcache::ActiveSupportStore
|
9
|
+
|
10
|
+
def initialize(options = {})
|
11
|
+
super() # Rails 2.3.x Store doesn't take any arguments to initialize
|
12
|
+
@ehcache = self.create_cache
|
13
|
+
end
|
14
|
+
|
15
|
+
def read(key, options = nil)
|
16
|
+
@ehcache[key]
|
17
|
+
rescue Ehcache::EhcacheError => e
|
18
|
+
logger.error("EhcacheError (#{e}): #{e.message}")
|
19
|
+
false
|
20
|
+
end
|
21
|
+
|
22
|
+
def write(key, value, options = {})
|
23
|
+
@ehcache.put(key, value, options)
|
24
|
+
true
|
25
|
+
rescue Ehcache::EhcacheError => e
|
26
|
+
logger.error("EhcacheError (#{e}): #{e.message}")
|
27
|
+
false
|
28
|
+
end
|
29
|
+
|
30
|
+
def delete(key, options = nil)
|
31
|
+
@ehcache.remove(key)
|
32
|
+
rescue Exception => e
|
33
|
+
logger.error("EhcacheError (#{e}): #{e.message}")
|
34
|
+
false
|
35
|
+
end
|
36
|
+
|
37
|
+
def keys
|
38
|
+
@ehcache.keys
|
39
|
+
end
|
40
|
+
|
41
|
+
def exist?(key, options = nil)
|
42
|
+
@ehcache.exist?(key)
|
43
|
+
end
|
44
|
+
|
45
|
+
def delete_matched(matcher, options = nil)
|
46
|
+
super
|
47
|
+
raise "Not supported by Ehcache"
|
48
|
+
end
|
49
|
+
|
50
|
+
def clear
|
51
|
+
@ehcache.clear
|
52
|
+
true
|
53
|
+
rescue Exception => e
|
54
|
+
logger.error("EhcacheError (#{e}): #{e.message}")
|
55
|
+
false
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
data/lib/ehcache.rb
CHANGED
@@ -20,30 +20,3 @@ require 'ehcache/config'
|
|
20
20
|
require 'ehcache/cache'
|
21
21
|
require 'ehcache/cache_manager'
|
22
22
|
require 'ehcache/element'
|
23
|
-
|
24
|
-
if defined?(Rails)
|
25
|
-
require 'ehcache/active_support_store'
|
26
|
-
|
27
|
-
case Rails::VERSION::MAJOR
|
28
|
-
when 2
|
29
|
-
require 'active_support/ehcache_store' # AS 2 impl
|
30
|
-
|
31
|
-
ActiveSupport::Cache::EhcacheStore.config_directory = File.expand_path(File.join(RAILS_ROOT, 'config'))
|
32
|
-
ActiveSupport::Cache::EhcacheStore.default_cache_name = 'rails_cache'
|
33
|
-
|
34
|
-
when 3
|
35
|
-
require 'active_support/cache/ehcache_store' # AS 3 impl
|
36
|
-
|
37
|
-
# Railtie
|
38
|
-
module Ehcache
|
39
|
-
class Railtie < ::Rails::Railtie
|
40
|
-
initializer "ehcache.setup_paths" do
|
41
|
-
ActiveSupport::Cache::EhcacheStore.config_directory = File.expand_path(File.join(::Rails.root, 'config'))
|
42
|
-
ActiveSupport::Cache::EhcacheStore.default_cache_name = 'rails_cache'
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# Common code used in the ehcache_store implementations for ActiveSupport 2.x and 3.x
|
2
|
+
require 'active_support'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'ehcache'
|
6
|
+
rescue LoadError => e
|
7
|
+
$stderr.puts "You don't have ehcache installed in your application."
|
8
|
+
$stderr.puts "Please add it to your Gemfile and run bundle install"
|
9
|
+
raise e
|
10
|
+
end
|
11
|
+
|
12
|
+
# Base class for both the ActiveSupport 2 & 3 implementations
|
13
|
+
module Ehcache
|
14
|
+
class ActiveSupportStore < ActiveSupport::Cache::Store
|
15
|
+
|
16
|
+
cattr_accessor :config_directory
|
17
|
+
cattr_accessor :default_cache_name
|
18
|
+
|
19
|
+
attr_reader :cache_manager
|
20
|
+
|
21
|
+
def create_cache_manager(options = {})
|
22
|
+
config_dir = self.class.config_directory
|
23
|
+
config = if options[:ehcache_config]
|
24
|
+
File.expand_path(File.join(config_dir, options[:ehcache_config]))
|
25
|
+
else
|
26
|
+
Ehcache::Config::Configuration.find(config_dir) if config_dir
|
27
|
+
end
|
28
|
+
# Ehcache will use the failsafe configuration if nothing is passed in
|
29
|
+
# Note: .create is a factory method
|
30
|
+
@cache_manager = Ehcache::CacheManager.create(config)
|
31
|
+
end
|
32
|
+
|
33
|
+
def create_cache(options = {})
|
34
|
+
create_cache_manager(options) if @cache_manager.nil?
|
35
|
+
@cache_manager.cache(options[:cache_name] || default_cache_name)
|
36
|
+
end
|
37
|
+
|
38
|
+
def default_cache_name
|
39
|
+
self.class.default_cache_name || 'app_cache'
|
40
|
+
end
|
41
|
+
|
42
|
+
at_exit do
|
43
|
+
@cache_manager.shutdown if @cache_manager
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
if defined?(Rails)
|
50
|
+
Ehcache::ActiveSupportStore.default_cache_name = 'rails_cache'
|
51
|
+
|
52
|
+
case Rails::VERSION::MAJOR
|
53
|
+
when 2
|
54
|
+
Ehcache::ActiveSupportStore.config_directory = File.expand_path(File.join(RAILS_ROOT, 'config'))
|
55
|
+
when 3
|
56
|
+
Ehcache::ActiveSupportStore.config_directory = File.expand_path(File.join(::Rails.root, 'config'))
|
57
|
+
end
|
58
|
+
end
|
data/lib/ehcache/cache.rb
CHANGED
@@ -10,6 +10,13 @@ class Java::NetSfEhcache::Cache
|
|
10
10
|
yield self.get(key)
|
11
11
|
end
|
12
12
|
end
|
13
|
+
|
14
|
+
# Does this cache require marshalling of Ruby objects?
|
15
|
+
def marshal?
|
16
|
+
config = self.cache_configuration
|
17
|
+
config.overflow_to_disk? || config.overflow_to_off_heap? || config.terracotta_clustered?
|
18
|
+
end
|
19
|
+
|
13
20
|
# Gets an element value from the cache. Unlike the #get method, this method
|
14
21
|
# returns the element value, not the Element object.
|
15
22
|
def [](key)
|
@@ -26,7 +33,10 @@ class Java::NetSfEhcache::Cache
|
|
26
33
|
if args.size == 1 && args.first.kind_of?(Ehcache::Element)
|
27
34
|
element = args.first
|
28
35
|
elsif args.size == 2
|
29
|
-
|
36
|
+
if marshal?
|
37
|
+
value = Java::NetSfEhcache::MarshaledRubyObject.new(Marshal.dump(args[1]).to_java_bytes)
|
38
|
+
end
|
39
|
+
element = Ehcache::Element.create(args[0], value, options)
|
30
40
|
else
|
31
41
|
raise ArgumentError, "Must be Element object or key and value arguments"
|
32
42
|
end
|
data/lib/ehcache/element.rb
CHANGED
@@ -9,6 +9,18 @@ class Java::NetSfEhcache::Element
|
|
9
9
|
result
|
10
10
|
end
|
11
11
|
|
12
|
+
alias element_value value
|
13
|
+
|
14
|
+
# Wrap the Element#value method to unmarshal Ruby objects if necessary.
|
15
|
+
def value
|
16
|
+
val = element_value
|
17
|
+
if val.kind_of?(Java::NetSfEhcache::MarshaledRubyObject)
|
18
|
+
Marshal.load(String.from_java_bytes(val.bytes))
|
19
|
+
else
|
20
|
+
val
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
12
24
|
alias tti getTimeToIdle
|
13
25
|
alias ttl getTimeToLive
|
14
26
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
package net.sf.ehcache;
|
2
|
+
|
3
|
+
import java.io.Serializable;
|
4
|
+
|
5
|
+
public class MarshaledRubyObject implements Serializable {
|
6
|
+
private byte[] bytes;
|
7
|
+
|
8
|
+
public MarshaledRubyObject(byte[] bytes) {
|
9
|
+
this.bytes = bytes;
|
10
|
+
}
|
11
|
+
|
12
|
+
public byte[] getBytes() {
|
13
|
+
return this.bytes;
|
14
|
+
}
|
15
|
+
}
|
metadata
CHANGED
@@ -1,230 +1,133 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: jruby-ehcache
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.2.1
|
4
5
|
prerelease:
|
5
|
-
version: 1.2.0
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
8
|
-
|
9
|
-
|
7
|
+
authors:
|
8
|
+
- Dylan Stamat
|
9
|
+
- Jason Voegele
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
type: :runtime
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
|
-
version_requirements: &id002 !ruby/object:Gem::Requirement
|
30
|
-
none: false
|
31
|
-
requirements:
|
32
|
-
- - ">="
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: "0"
|
35
|
-
requirement: *id002
|
36
|
-
prerelease: false
|
37
|
-
type: :development
|
38
|
-
- !ruby/object:Gem::Dependency
|
39
|
-
name: jeweler
|
40
|
-
version_requirements: &id003 !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ">="
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: "0"
|
46
|
-
requirement: *id003
|
47
|
-
prerelease: false
|
48
|
-
type: :development
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: rake
|
51
|
-
version_requirements: &id004 !ruby/object:Gem::Requirement
|
52
|
-
none: false
|
53
|
-
requirements:
|
54
|
-
- - ">="
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version: "0"
|
57
|
-
requirement: *id004
|
58
|
-
prerelease: false
|
59
|
-
type: :development
|
60
|
-
- !ruby/object:Gem::Dependency
|
61
|
-
name: jeweler
|
62
|
-
version_requirements: &id005 !ruby/object:Gem::Requirement
|
63
|
-
none: false
|
64
|
-
requirements:
|
65
|
-
- - ">="
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
version: "0"
|
68
|
-
requirement: *id005
|
69
|
-
prerelease: false
|
70
|
-
type: :development
|
71
|
-
- !ruby/object:Gem::Dependency
|
72
|
-
name: rake
|
73
|
-
version_requirements: &id006 !ruby/object:Gem::Requirement
|
74
|
-
none: false
|
75
|
-
requirements:
|
76
|
-
- - ">="
|
77
|
-
- !ruby/object:Gem::Version
|
78
|
-
version: "0"
|
79
|
-
requirement: *id006
|
80
|
-
prerelease: false
|
81
|
-
type: :development
|
82
|
-
- !ruby/object:Gem::Dependency
|
83
|
-
name: jeweler
|
84
|
-
version_requirements: &id007 !ruby/object:Gem::Requirement
|
85
|
-
none: false
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: "0"
|
90
|
-
requirement: *id007
|
91
|
-
prerelease: false
|
92
|
-
type: :development
|
93
|
-
- !ruby/object:Gem::Dependency
|
94
|
-
name: activesupport
|
95
|
-
version_requirements: &id008 !ruby/object:Gem::Requirement
|
96
|
-
none: false
|
97
|
-
requirements:
|
98
|
-
- - ">="
|
99
|
-
- !ruby/object:Gem::Version
|
100
|
-
version: "0"
|
101
|
-
requirement: *id008
|
102
|
-
prerelease: false
|
103
|
-
type: :runtime
|
104
|
-
- !ruby/object:Gem::Dependency
|
105
|
-
name: i18n
|
106
|
-
version_requirements: &id009 !ruby/object:Gem::Requirement
|
107
|
-
none: false
|
108
|
-
requirements:
|
109
|
-
- - ">="
|
110
|
-
- !ruby/object:Gem::Version
|
111
|
-
version: "0"
|
112
|
-
requirement: *id009
|
113
|
-
prerelease: false
|
114
|
-
type: :runtime
|
115
|
-
- !ruby/object:Gem::Dependency
|
116
|
-
name: rake
|
117
|
-
version_requirements: &id010 !ruby/object:Gem::Requirement
|
118
|
-
none: false
|
119
|
-
requirements:
|
120
|
-
- - ">="
|
121
|
-
- !ruby/object:Gem::Version
|
122
|
-
version: "0"
|
123
|
-
requirement: *id010
|
124
|
-
prerelease: false
|
125
|
-
type: :development
|
126
|
-
- !ruby/object:Gem::Dependency
|
127
|
-
name: jeweler
|
128
|
-
version_requirements: &id011 !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
|
-
requirements:
|
131
|
-
- - ">="
|
132
|
-
- !ruby/object:Gem::Version
|
133
|
-
version: "0"
|
134
|
-
requirement: *id011
|
135
|
-
prerelease: false
|
136
|
-
type: :development
|
13
|
+
date: 2012-03-14 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: i18n
|
17
|
+
requirement: &70252855820620 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *70252855820620
|
137
26
|
description: JRuby interface to the popular Java caching library Ehcache
|
138
|
-
email:
|
139
|
-
|
140
|
-
|
141
|
-
executables:
|
142
|
-
|
27
|
+
email:
|
28
|
+
- dstamat@elctech.com
|
29
|
+
- jvoegele@terracotta.org
|
30
|
+
executables:
|
31
|
+
- ehcache
|
143
32
|
extensions: []
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
33
|
+
extra_rdoc_files:
|
34
|
+
- README.txt
|
35
|
+
files:
|
36
|
+
- .gitignore
|
37
|
+
- Gemfile
|
38
|
+
- Gemfile.lock
|
39
|
+
- History.txt
|
40
|
+
- License.txt
|
41
|
+
- Manifest.txt
|
42
|
+
- PostInstall.txt
|
43
|
+
- README.txt
|
44
|
+
- Rakefile
|
45
|
+
- VERSION
|
46
|
+
- bin/ehcache
|
47
|
+
- config/ehcache.yml
|
48
|
+
- config/ehcache_manual_rmi.yml
|
49
|
+
- examples/ehcache.xml
|
50
|
+
- examples/jruby-ehcache.rb
|
51
|
+
- ext/ehcache-2.4.6/ehcache-core-2.4.6.jar
|
52
|
+
- ext/ehcache-2.4.6/ehcache-terracotta-2.4.6.jar
|
53
|
+
- ext/ehcache-2.4.6/slf4j-api-1.6.1.jar
|
54
|
+
- ext/ehcache-2.4.6/slf4j-jdk14-1.6.1.jar
|
55
|
+
- ext/ehcache-2.4.6/terracotta-toolkit-1.3-runtime-3.3.0.jar
|
56
|
+
- ext/marshaled-ruby-object.jar
|
57
|
+
- jruby-ehcache-rails2.gemspec
|
58
|
+
- jruby-ehcache-rails3.gemspec
|
59
|
+
- jruby-ehcache.gemspec
|
60
|
+
- lib/active_support/cache/ehcache_store.rb
|
61
|
+
- lib/active_support/ehcache_store.rb
|
62
|
+
- lib/ehcache.rb
|
63
|
+
- lib/ehcache/active_support_store.rb
|
64
|
+
- lib/ehcache/cache.rb
|
65
|
+
- lib/ehcache/cache_manager.rb
|
66
|
+
- lib/ehcache/config.rb
|
67
|
+
- lib/ehcache/element.rb
|
68
|
+
- lib/ehcache/java.rb
|
69
|
+
- lib/ehcache/version.rb
|
70
|
+
- lib/ehcache/yaml_config.rb
|
71
|
+
- script/console
|
72
|
+
- script/destroy
|
73
|
+
- script/generate
|
74
|
+
- script/txt2html
|
75
|
+
- spec/cache_manager_spec.rb
|
76
|
+
- spec/cache_spec.rb
|
77
|
+
- spec/spec.opts
|
78
|
+
- spec/spec_helper.rb
|
79
|
+
- src/net/sf/ehcache/MarshaledRubyObject.java
|
80
|
+
- tasks/deployment.rake
|
81
|
+
- tasks/environment.rake
|
82
|
+
- tasks/website.rake
|
83
|
+
- test/ehcache.xml
|
84
|
+
- test/ehcache.yml
|
85
|
+
- test/test_cache.rb
|
86
|
+
- test/test_cache_manager.rb
|
87
|
+
- test/test_configuration.rb
|
88
|
+
- test/test_ehcache.rb
|
89
|
+
- test/test_element.rb
|
90
|
+
- test/test_helper.rb
|
91
|
+
- test/test_yaml_config.rb
|
92
|
+
- website/index.html
|
93
|
+
- website/javascripts/rounded_corners_lite.inc.js
|
94
|
+
- website/stylesheets/screen.css
|
95
|
+
- website/template.html.erb
|
202
96
|
homepage: http://ehcache.rubyforge.org
|
203
97
|
licenses: []
|
204
|
-
|
205
98
|
post_install_message:
|
206
99
|
rdoc_options: []
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
100
|
+
require_paths:
|
101
|
+
- lib
|
102
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
211
103
|
none: false
|
212
|
-
requirements:
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - ! '>='
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0'
|
108
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
217
109
|
none: false
|
218
|
-
requirements:
|
219
|
-
|
220
|
-
|
221
|
-
|
110
|
+
requirements:
|
111
|
+
- - ! '>='
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
222
114
|
requirements: []
|
223
|
-
|
224
115
|
rubyforge_project: ehcache
|
225
|
-
rubygems_version: 1.8.
|
116
|
+
rubygems_version: 1.8.15
|
226
117
|
signing_key:
|
227
118
|
specification_version: 3
|
228
119
|
summary: JRuby interface to Ehcache
|
229
|
-
test_files:
|
230
|
-
|
120
|
+
test_files:
|
121
|
+
- spec/cache_manager_spec.rb
|
122
|
+
- spec/cache_spec.rb
|
123
|
+
- spec/spec.opts
|
124
|
+
- spec/spec_helper.rb
|
125
|
+
- test/ehcache.xml
|
126
|
+
- test/ehcache.yml
|
127
|
+
- test/test_cache.rb
|
128
|
+
- test/test_cache_manager.rb
|
129
|
+
- test/test_configuration.rb
|
130
|
+
- test/test_ehcache.rb
|
131
|
+
- test/test_element.rb
|
132
|
+
- test/test_helper.rb
|
133
|
+
- test/test_yaml_config.rb
|
data/lib/ehcache/extensions.rb
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
require 'active_support/core_ext/string/inflections'
|
2
|
-
require 'active_support/core_ext/array/extract_options'
|
3
|
-
|
4
|
-
class Hash
|
5
|
-
# Merges self with another hash, recursively.
|
6
|
-
# This code was lovingly stolen from some random gem:
|
7
|
-
# http://gemjack.com/gems/tartan-0.1.1/classes/Hash.html
|
8
|
-
# Thanks to whoever made it.
|
9
|
-
def deep_merge(hash)
|
10
|
-
target = dup
|
11
|
-
|
12
|
-
hash.keys.each do |key|
|
13
|
-
if hash[key].is_a? Hash and self[key].is_a? Hash
|
14
|
-
target[key] = target[key].deep_merge(hash[key])
|
15
|
-
next
|
16
|
-
end
|
17
|
-
target[key] = hash[key]
|
18
|
-
end
|
19
|
-
target
|
20
|
-
end
|
21
|
-
|
22
|
-
def deep_merge!(second)
|
23
|
-
second.each_pair do |k,v|
|
24
|
-
if self[k].is_a?(Hash) and second[k].is_a?(Hash)
|
25
|
-
self[k].deep_merge!(second[k])
|
26
|
-
else
|
27
|
-
self[k] = second[k]
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|