appoxy-local_cache 1.1.0 → 1.1.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/lib/local_cache.rb +28 -1
- metadata +4 -3
data/lib/local_cache.rb
CHANGED
@@ -34,8 +34,35 @@ module ActiveSupport
|
|
34
34
|
return nil
|
35
35
|
end
|
36
36
|
|
37
|
-
def
|
37
|
+
def get_multi(keys, raw=false)
|
38
|
+
ret = {}
|
39
|
+
keys.each do |k|
|
40
|
+
val = get(k)
|
41
|
+
ret[k] = val unless val.nil?
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def get_i(key)
|
46
|
+
val = get(key)
|
47
|
+
return nil if val.nil?
|
48
|
+
return val.to_i
|
49
|
+
end
|
50
|
+
|
51
|
+
def exist?(key)
|
52
|
+
return !get(key).nil?
|
53
|
+
end
|
54
|
+
|
55
|
+
def increment(key, val=1)
|
56
|
+
ret = get(key)
|
57
|
+
if ret.is_a?(Fixnum)
|
58
|
+
ret += val
|
59
|
+
else
|
60
|
+
ret = val
|
61
|
+
put(key, ret)
|
62
|
+
end
|
63
|
+
end
|
38
64
|
|
65
|
+
def put(key, val, seconds_to_store=999999, raw=false)
|
39
66
|
seconds_to_store = seconds_to_store || @default_expires_in
|
40
67
|
#puts 'seconds=' + seconds_to_store.to_s
|
41
68
|
@cache[key] = [Time.now+seconds_to_store, val]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appoxy-local_cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Travis Reeder
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-08-04 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -26,6 +26,7 @@ files:
|
|
26
26
|
- README.markdown
|
27
27
|
has_rdoc: true
|
28
28
|
homepage: http://github.com/appoxy/local_cache/
|
29
|
+
licenses:
|
29
30
|
post_install_message:
|
30
31
|
rdoc_options:
|
31
32
|
- --charset=UTF-8
|
@@ -46,7 +47,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
46
47
|
requirements: []
|
47
48
|
|
48
49
|
rubyforge_project:
|
49
|
-
rubygems_version: 1.
|
50
|
+
rubygems_version: 1.3.5
|
50
51
|
signing_key:
|
51
52
|
specification_version: 2
|
52
53
|
summary: Similar to Rails' built in MemoryStore, but adds size limit and expiration.
|