autobots 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -0
- data/lib/autobots/helpers/caching.rb +7 -2
- data/lib/autobots/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c09d3a52f075f9dbe81a701a194accac21f4f7af
|
4
|
+
data.tar.gz: 0c1733a2c3849202f8928b0b85f3b3420dcc3923
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 08f178e8886f9fd654e6852bd83fd9f11e46df46ac776378232e364ce5a3afa74063f36e5ff1ce2c20eb0214b118b8b79aa7942e77ce293d98d1f1d42a35ff1a
|
7
|
+
data.tar.gz: b62ee5b7c4390ac766ff35f3902ded5f757224dfb34cabe31d4c99fd2b2df7ce9f0770fb0917230ab75aaf85b71b3f82032f9dc56ff398dd6c3a17cfa11c2c82
|
data/README.md
CHANGED
@@ -118,6 +118,13 @@ The default behavior of an assembler is to wrap each object with the declared se
|
|
118
118
|
|
119
119
|
We can get large performance boosts by caching our serializable data. Caching is straight forward:
|
120
120
|
|
121
|
+
class ProjectAssembler < Autobots::Assembler
|
122
|
+
# some sort of ActiveSupport::CacheStore
|
123
|
+
self.cache = Rails.cache
|
124
|
+
end
|
125
|
+
|
126
|
+
Alternatively, you can set the cache on an instance:
|
127
|
+
|
121
128
|
# some sort of ActiveSupport::CacheStore
|
122
129
|
cache = Rails.cache
|
123
130
|
assembler = ProjectAssembler.new(project_ids, cache: cache)
|
@@ -13,7 +13,7 @@ module Autobots
|
|
13
13
|
class_attribute :cache
|
14
14
|
end
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
def data
|
18
18
|
return @data if defined?(@data)
|
19
19
|
|
@@ -38,8 +38,13 @@ module Autobots
|
|
38
38
|
|
39
39
|
protected
|
40
40
|
|
41
|
+
def serializer_cache_key
|
42
|
+
return @serializer_cache_key if defined?(@serializer_cache_key)
|
43
|
+
@serializer_cache_key = [serializer.name, Digest::SHA256.hexdigest(serializer._attributes.keys.to_s)[0..12]]
|
44
|
+
end
|
45
|
+
|
41
46
|
def cache_key(object, _)
|
42
|
-
[object.cache_key,
|
47
|
+
[object.cache_key, *self.serializer_cache_key, 'serializable-hash']
|
43
48
|
end
|
44
49
|
end
|
45
50
|
end
|
data/lib/autobots/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autobots
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Ching
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bulk_cache_fetcher
|