ksconnect 0.2.4 → 0.2.5
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.
- checksums.yaml +4 -4
- data/lib/ksconnect/api/plugin/data.rb +15 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53fb3974bc68bd3913f1877c535604c769f58130
|
4
|
+
data.tar.gz: 7a2a5f691ced3061a0c76aaaa1a035816e4e55bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31220e25b6cbc6c7f2e4eb1694a8f293b840d890ec8b5b4b94aff6ea0c21e0c243fa058f08576c6cee8758144d8782047c720a7cb5f0eee9b3dbdc9e86d8acd3
|
7
|
+
data.tar.gz: 226d38a0b84e4708f86b95a1a4a656cd5d6e9370f25986312203c0c0e4ba9e4ef5acef82a213117fd2a12a97845c8c15e5a7c6bbb06a84b694a39d2d6b9e31eb
|
@@ -15,8 +15,14 @@ class KSConnect
|
|
15
15
|
@domain_name = domain_name
|
16
16
|
|
17
17
|
@type = opts[:type] || "data"
|
18
|
-
@use_cache = opts[:use_cache].nil? ? true : !!opts[:use_cache]
|
19
18
|
@auto_notify = !!opts[:auto_notify]
|
19
|
+
@use_cache = true
|
20
|
+
|
21
|
+
if ENV['KSCONNECT_READ_ONLY']
|
22
|
+
@read_only = true
|
23
|
+
@use_cache = false
|
24
|
+
@auto_notify = false
|
25
|
+
end
|
20
26
|
|
21
27
|
@cache = ActiveSupport::HashWithIndifferentAccess.new if @use_cache
|
22
28
|
@cache_uuid = nil
|
@@ -26,6 +32,7 @@ class KSConnect
|
|
26
32
|
end
|
27
33
|
|
28
34
|
def []=(field, value)
|
35
|
+
raise 'Cannot modify key in read only mode' if @read_only
|
29
36
|
@cache[field] = value if @use_cache
|
30
37
|
$redis.with { |redis|
|
31
38
|
redis.hset(key, field, value)
|
@@ -34,6 +41,7 @@ class KSConnect
|
|
34
41
|
end
|
35
42
|
|
36
43
|
def setall(hash)
|
44
|
+
raise 'Cannot modify keys in read only mode' if @read_only
|
37
45
|
@cache.merge!(hash) if @use_cache
|
38
46
|
$redis.with { |redis|
|
39
47
|
redis.mapped_hmset(key, hash)
|
@@ -70,6 +78,7 @@ class KSConnect
|
|
70
78
|
end
|
71
79
|
|
72
80
|
def delete(field)
|
81
|
+
raise 'Cannot delete key in read only mode' if @read_only
|
73
82
|
$redis.with { |redis|
|
74
83
|
@cache.delete(field) if @use_cache
|
75
84
|
redis.hdel(key, field)
|
@@ -100,7 +109,11 @@ class KSConnect
|
|
100
109
|
logger.warn e.message
|
101
110
|
retry
|
102
111
|
else
|
103
|
-
|
112
|
+
if @read_only
|
113
|
+
raise e # re-raise if can't get uuid after all tries
|
114
|
+
else
|
115
|
+
'_NO_DATA_KEY'
|
116
|
+
end
|
104
117
|
end
|
105
118
|
end
|
106
119
|
}
|