cache_keeper 0.6.0 → 0.6.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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 919ef367b49336174acda56328421939872f1921ec23d349fedca66e23a01815
|
4
|
+
data.tar.gz: 2cdf9e582968a16557b06534a28d77298957b1474a04c552fffa7e130015b6e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72094507997a5a056faa3e61438f1725d7e9787bf4ce4b710a1d071c55a9e93f576c5ff680d88940838a69f38aef1ef9b6aad9e43f74f7e8a5104180d5d910cb
|
7
|
+
data.tar.gz: 585089805bde2aa9ec878d4c0e01ed1eb5f73d9a28fb98e51e1b83e34ea4db1de3f274849d6f6427e25e7263d2c3a7f945277ebaec67643823ba78f1e6566dc3
|
data/README.md
CHANGED
@@ -59,6 +59,8 @@ CacheKeeper will compose cache keys from the name of the method and the instance
|
|
59
59
|
|
60
60
|
```ruby
|
61
61
|
class NebulaNoodleTwister
|
62
|
+
include CacheKeeper::Caching
|
63
|
+
|
62
64
|
caches :twist_noodles, :dish_of_the_day, key: ->(method_name) { [:recoding, id, method_name] }
|
63
65
|
caches :synchronize_taste_buds, key: -> { [:recoding, id, :synchronize_taste_buds] }
|
64
66
|
caches :space_soup_simulation, key: :space_soup_simulation
|
@@ -71,6 +73,8 @@ CacheKeeper needs to pass the instance on which the cached method is called alon
|
|
71
73
|
|
72
74
|
```ruby
|
73
75
|
class QuantumQuackerator
|
76
|
+
include CacheKeeper::Caching
|
77
|
+
|
74
78
|
# Generate a new instance using an empty initializer (QuantumQuackerator.new)
|
75
79
|
# Useful for controllers and for POROs with no arguments
|
76
80
|
caches :quackify_particles, serializer: :new_instance
|
@@ -1,9 +1,9 @@
|
|
1
1
|
class CacheKeeper::MarshalSerializer < ActiveJob::Serializers::ObjectSerializer
|
2
2
|
def serialize(target)
|
3
|
-
super("dump" => Marshal.dump(target)
|
3
|
+
super("dump" => Base64.encode64(Marshal.dump(target)))
|
4
4
|
end
|
5
5
|
|
6
6
|
def deserialize(json)
|
7
|
-
Marshal.load(json["dump"]
|
7
|
+
Marshal.load Base64.decode64(json["dump"])
|
8
8
|
end
|
9
9
|
end
|
data/lib/cache_keeper/version.rb
CHANGED
@@ -5,7 +5,7 @@ class CacheKeeper::MarshalSerializerTest < ActiveSupport::TestCase
|
|
5
5
|
target = Recording.new
|
6
6
|
serialized = serializer.serialize(target)
|
7
7
|
|
8
|
-
assert_equal serialized["dump"], Marshal.dump(target)
|
8
|
+
assert_equal serialized["dump"], Base64.encode64(Marshal.dump(target))
|
9
9
|
end
|
10
10
|
|
11
11
|
test "deserializes the marshal dump" do
|