ocm 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ocm/iron_cache_orm.rb +13 -3
- data/lib/ocm/version.rb +1 -1
- metadata +2 -2
data/lib/ocm/iron_cache_orm.rb
CHANGED
@@ -57,9 +57,9 @@ module Ocm
|
|
57
57
|
def update_in_list(key, item, comps)
|
58
58
|
messages = get_list(key)
|
59
59
|
Ocm.logger.debug "update_in_list: messages: #{messages.inspect}"
|
60
|
-
messages.each_with_index do |m,i|
|
60
|
+
messages.each_with_index do |m, i|
|
61
61
|
match = true
|
62
|
-
comps.each_pair do |k,v|
|
62
|
+
comps.each_pair do |k, v|
|
63
63
|
if m.is_a?(Hash)
|
64
64
|
if m[k.to_s] != v
|
65
65
|
match = false
|
@@ -73,7 +73,11 @@ module Ocm
|
|
73
73
|
end
|
74
74
|
end
|
75
75
|
if match
|
76
|
-
|
76
|
+
if item
|
77
|
+
messages[i] = item
|
78
|
+
else
|
79
|
+
messages.delete_at(i)
|
80
|
+
end
|
77
81
|
put(key, messages)
|
78
82
|
return
|
79
83
|
end
|
@@ -95,6 +99,12 @@ module Ocm
|
|
95
99
|
put(key, messages)
|
96
100
|
end
|
97
101
|
|
102
|
+
# Warning, this is not a safe operation, be sure it is only being called once at a time
|
103
|
+
def remove_from_list(key, comps)
|
104
|
+
#id = item.is_a?(String) ? item : item.id
|
105
|
+
update_in_list(key, nil, comps)
|
106
|
+
end
|
107
|
+
|
98
108
|
def find(clazz, id)
|
99
109
|
get(key_for(clazz, id))
|
100
110
|
end
|
data/lib/ocm/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ocm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-12-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: iron_cache
|