redis-stream 0.4.5 → 0.4.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 83de723fa0769050b81548f00ce3d662b9053b1d89974b314f188756af759e1d
4
- data.tar.gz: 83f878051c67908db42aa52928f2f3ba7746d9d7fd40a888dc9412f40db1fc82
3
+ metadata.gz: f717daecee4d177674a113217514c86d58fbb833fbd7e3a8751263f1c110b26a
4
+ data.tar.gz: a78aef2ebb19708c634c02e87b2039b1f1ceb7f3a04cc1aeecc929076130f35c
5
5
  SHA512:
6
- metadata.gz: dd2618538cb98cd88861e76d3024e5bd54d241669e056763d2986989f6b50cfc7fb24a921aba4d08a6b2ecce005031ac53e9f8639411f991cbe7774fbfec34cc
7
- data.tar.gz: e781755937ba2901eeafa7273bf7eea5ceb3bfa8a1c6f2011b196b3ae0695b80413342e3fa1b4ebd147eb08fae4f36e6c618685f29c37379f2844419684e2288
6
+ metadata.gz: 380bfb8e1ea254d1e9cb3ab5d0c0367eaefe350671cc85ac0e7c34d9512965a9a00e7840745f759b45f172ad91d78db1e4774a39d542410f2b1cc6072a95be68
7
+ data.tar.gz: f0531ee5f9e2cc442ec9339c3935e0bd83c6930fe4e3476d843505c985f9d3f814e9ce44e584ed243f8cd4f7e27da45efad76605252ecf705cf01c898880a33d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- redis-stream (0.4.4)
4
+ redis-stream (0.4.6)
5
5
  moneta (~> 1.2)
6
6
  multi_json (~> 1.14)
7
7
  redis (= 4.1.3)
@@ -31,6 +31,14 @@ class Redis
31
31
  @cache.delete(key)
32
32
  end
33
33
 
34
+ def key_prefix=(prefix)
35
+ @key_prefix = prefix.downcase
36
+ end
37
+
38
+ def key_prefix
39
+ @key_prefix
40
+ end
41
+
34
42
  def build_key(data)
35
43
  key = ""
36
44
  if data && data.include?('payload')
@@ -40,9 +48,9 @@ class Redis
40
48
  end
41
49
 
42
50
  if payload_data.include?("id")
43
- action = payload_data["action"].downcase
44
51
  id = payload_data["id"].downcase
45
- key = "#{action}_#{id}"
52
+ key = "#{id}"
53
+ key = "#{@key_prefix}_#{key}" unless @key_prefix.nil? || @key_prefix&.empty?
46
54
  end
47
55
  raise "Empty cache key" if key.nil? || key&.empty?
48
56
  key
@@ -87,10 +95,13 @@ class Redis
87
95
  end
88
96
 
89
97
  def get_from_cache(cache_key)
90
- include?(cache_key)
98
+ key?(cache_key)
91
99
 
92
100
  data = self[cache_key]
93
- data = get_from_cache(data['parent']) if data.key?('parent')
101
+ if data&.key?('parent')
102
+ data = get_from_cache(self.build_key({'id' => data['parent']}))
103
+ end
104
+
94
105
  data
95
106
  end
96
107
  end
@@ -1,6 +1,6 @@
1
1
  #encoding: UTF-8
2
2
  class Redis
3
3
  module Stream
4
- VERSION = "0.4.5"
4
+ VERSION = "0.4.6"
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis-stream
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mehmet Celik