denen99-activesupport-gemfirecache 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +0 -0
- data/LICENSE +24 -0
- data/README +0 -0
- data/README.txt +54 -0
- data/lib/active_support/cache/gemfire_cache_store.rb +77 -0
- data/lib/gemfire_cache_store.rb +37 -0
- metadata +61 -0
data/History.txt
ADDED
File without changes
|
data/LICENSE
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
== LICENSE:
|
2
|
+
|
3
|
+
(The MIT License)
|
4
|
+
|
5
|
+
Copyright (c) 2009 Adam Denenberg
|
6
|
+
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
8
|
+
a copy of this software and associated documentation files (the
|
9
|
+
'Software'), to deal in the Software without restriction, including
|
10
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
11
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
12
|
+
permit persons to whom the Software is furnished to do so, subject to
|
13
|
+
the following conditions:
|
14
|
+
|
15
|
+
The above copyright notice and this permission notice shall be
|
16
|
+
included in all copies or substantial portions of the Software.
|
17
|
+
|
18
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
19
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
20
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
21
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
22
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
23
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
24
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README
ADDED
File without changes
|
data/README.txt
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
= activesupport-gemfirecache
|
2
|
+
|
3
|
+
== DESCRIPTION:
|
4
|
+
|
5
|
+
ActiveSupport-gemfirecache is a jRuby on Rails extension that enables a GemFire backend store for Rails.cache
|
6
|
+
|
7
|
+
== FEATURES/PROBLEMS:
|
8
|
+
|
9
|
+
|
10
|
+
== REQUIREMENTS:
|
11
|
+
|
12
|
+
* ActiveSupport 2.3.2
|
13
|
+
* GemFire 6 or later
|
14
|
+
|
15
|
+
== INSTALL:
|
16
|
+
|
17
|
+
* sudo gem install activesupport-gemfirecache
|
18
|
+
* cp gemfire.jar into lib directory (i.e., lib/ if using Rails)
|
19
|
+
* need a copy of gemfireLicense.zip in root directory (root of Rails app if using Rails)
|
20
|
+
|
21
|
+
|
22
|
+
== CONFIGURATION:
|
23
|
+
|
24
|
+
In your config/environment.rb, add the following:
|
25
|
+
|
26
|
+
if defined?(JRUBY_VERSION)
|
27
|
+
config.gem "activesupport-gemfirecache", :lib => 'gemfire_cache_store'
|
28
|
+
config.cache_store = :gemfire_cache_store
|
29
|
+
end
|
30
|
+
|
31
|
+
== LICENSE:
|
32
|
+
|
33
|
+
(The MIT License)
|
34
|
+
|
35
|
+
Copyright (c) 2009 Adam Denenberg
|
36
|
+
|
37
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
38
|
+
a copy of this software and associated documentation files (the
|
39
|
+
'Software'), to deal in the Software without restriction, including
|
40
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
41
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
42
|
+
permit persons to whom the Software is furnished to do so, subject to
|
43
|
+
the following conditions:
|
44
|
+
|
45
|
+
The above copyright notice and this permission notice shall be
|
46
|
+
included in all copies or substantial portions of the Software.
|
47
|
+
|
48
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
49
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
50
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
51
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
52
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
53
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
54
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,77 @@
|
|
1
|
+
require 'activesupport'
|
2
|
+
require 'lib/gemfire.jar'
|
3
|
+
|
4
|
+
import "java.util.Properties"
|
5
|
+
import "com.gemstone.gemfire.cache.Cache"
|
6
|
+
import "com.gemstone.gemfire.cache.CacheFactory"
|
7
|
+
import "com.gemstone.gemfire.cache.Region"
|
8
|
+
import "com.gemstone.gemfire.distributed.DistributedSystem"
|
9
|
+
|
10
|
+
module ActiveSupport
|
11
|
+
module Cache
|
12
|
+
class GemfireCacheStore < Store
|
13
|
+
VERSION = '0.0.4'
|
14
|
+
|
15
|
+
class CacheException < StandardError; end
|
16
|
+
|
17
|
+
def initialize(options = {})
|
18
|
+
props = Properties.new();
|
19
|
+
props.set_property("name", "GemFireCacheStore")
|
20
|
+
ds = DistributedSystem.connect(props)
|
21
|
+
@cache = CacheFactory.create(ds)
|
22
|
+
@factory = AttributesFactory.new
|
23
|
+
@region = @cache.createRegion("RubyGemFireCacheStore",@factory.createRegionAttributes)
|
24
|
+
end
|
25
|
+
|
26
|
+
def region
|
27
|
+
@region
|
28
|
+
end
|
29
|
+
|
30
|
+
def read(key, options = nil)
|
31
|
+
super
|
32
|
+
@region.get(key)
|
33
|
+
rescue CacheException => e
|
34
|
+
logger.error("GemfireCache Error (#{e}): #{e.message}")
|
35
|
+
false
|
36
|
+
end
|
37
|
+
|
38
|
+
def write(key, value, options = {})
|
39
|
+
super
|
40
|
+
@region.put(key, value)
|
41
|
+
true
|
42
|
+
rescue CacheException => e
|
43
|
+
logger.error("GemfireCache Error (#{e}): #{e.message}")
|
44
|
+
false
|
45
|
+
end
|
46
|
+
|
47
|
+
def delete(key, options = nil)
|
48
|
+
super
|
49
|
+
@region.destroy(key)
|
50
|
+
rescue CacheException => e
|
51
|
+
logger.error("GemfireCache Error (#{e}): #{e.message}")
|
52
|
+
false
|
53
|
+
end
|
54
|
+
|
55
|
+
def keys
|
56
|
+
@region.keys.to_a
|
57
|
+
end
|
58
|
+
|
59
|
+
def exist?(key, options = nil)
|
60
|
+
@data.containsKey(key)
|
61
|
+
end
|
62
|
+
|
63
|
+
def delete_matched(matcher, options = nil)
|
64
|
+
super
|
65
|
+
raise "Not supported by Gemfire"
|
66
|
+
end
|
67
|
+
|
68
|
+
def clear
|
69
|
+
@data.clear
|
70
|
+
true
|
71
|
+
rescue CacheException => e
|
72
|
+
logger.error("GemfireCache Error (#{e}): #{e.message}")
|
73
|
+
false
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2009 Adam Denenberg
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
# a copy of this software and associated documentation files (the
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
# the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
#++
|
23
|
+
|
24
|
+
$:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
25
|
+
|
26
|
+
if defined?(JRUBY_VERSION)
|
27
|
+
require 'java'
|
28
|
+
require 'active_support/cache/gemfire_cache_store'
|
29
|
+
end
|
30
|
+
|
31
|
+
module ActiveSupport
|
32
|
+
module Cache
|
33
|
+
class GemfireCacheStore
|
34
|
+
VERSION = '0.0.4'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
metadata
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: denen99-activesupport-gemfirecache
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.4
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Adam Denenberg
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-09-18 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: ActiveSupport-GemfireCache is a Ruby library for interfacing to a gemfire cache.
|
17
|
+
email: tom@mojombo.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README
|
24
|
+
- LICENSE
|
25
|
+
files:
|
26
|
+
- History.txt
|
27
|
+
- README.txt
|
28
|
+
- lib/gemfire_cache_store.rb
|
29
|
+
- lib/active_support/cache/gemfire_cache_store.rb
|
30
|
+
- LICENSE
|
31
|
+
- README
|
32
|
+
has_rdoc: false
|
33
|
+
homepage: http://github.com/denen99/activesupport-gemfirecache
|
34
|
+
licenses:
|
35
|
+
post_install_message:
|
36
|
+
rdoc_options:
|
37
|
+
- --inline-source
|
38
|
+
- --charset=UTF-8
|
39
|
+
require_paths:
|
40
|
+
- lib
|
41
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: "0"
|
46
|
+
version:
|
47
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - ">="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: "0"
|
52
|
+
version:
|
53
|
+
requirements: []
|
54
|
+
|
55
|
+
rubyforge_project: activesupport-gemfirecache
|
56
|
+
rubygems_version: 1.3.5
|
57
|
+
signing_key:
|
58
|
+
specification_version: 2
|
59
|
+
summary: ActiveSupport-GemfireCache is a Ruby library for interfacing to a gemfire cache
|
60
|
+
test_files: []
|
61
|
+
|