cache-object 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cache/object/active_record.rb +31 -0
- data/lib/cache/object/version.rb +1 -1
- 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: b00384e28562fe8f44389c201a32090c1a8e1a11
|
4
|
+
data.tar.gz: 8f92dbcb480d43eaf062356bd31477d38f43c481
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f8b87b32430f50a8095aadf5aaf56e51a9a05461d9e84de9fc67d186866ad94e821cf35853b23994f804cbd074eaeafe57e7095ff5d55e52c5e267072568d5a
|
7
|
+
data.tar.gz: e3acc42a006c8c8ac416b1474b98857ddf50d5ac3151d00297a36ccf9daf997aabf62b8b4c06112f984d9b88f1fdfe2b622679c9a53e03fa036c6792e31def93
|
@@ -17,6 +17,29 @@ module Cache
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
+
def _dump(level = 0)
|
21
|
+
Marshal.dump(attributes)
|
22
|
+
end
|
23
|
+
|
24
|
+
def load_from_cache(attributes)
|
25
|
+
attributes.each_pair do |key, value|
|
26
|
+
attributes[key] = value
|
27
|
+
end
|
28
|
+
|
29
|
+
@attributes = self.class.initialize_attributes(attributes)
|
30
|
+
@relation = nil
|
31
|
+
|
32
|
+
@attributes_cache, @previously_changed, @changed_attributes = {}, {}, {}
|
33
|
+
@association_cache = {}
|
34
|
+
@aggregation_cache = {}
|
35
|
+
@_start_transaction_state = {}
|
36
|
+
@readonly = @destroyed = @marked_for_destruction = false
|
37
|
+
@new_record = false
|
38
|
+
@column_types = self.class.column_types if self.class.respond_to?(:column_types)
|
39
|
+
@changed_attributes = {}
|
40
|
+
@new_record = false
|
41
|
+
end
|
42
|
+
|
20
43
|
def write_cache!
|
21
44
|
Cache::Object.adapter.write(_cache_object_decorator)
|
22
45
|
end
|
@@ -30,6 +53,14 @@ module Cache
|
|
30
53
|
end
|
31
54
|
|
32
55
|
module ClassMethods
|
56
|
+
def _load(args)
|
57
|
+
attributes = Marshal.load(args)
|
58
|
+
|
59
|
+
object = allocate
|
60
|
+
object.load_from_cache(attributes)
|
61
|
+
object
|
62
|
+
end
|
63
|
+
|
33
64
|
def find(*args)
|
34
65
|
Cache::Object.adapter.fetch(self, *args[0]) do
|
35
66
|
super(*args)
|
data/lib/cache/object/version.rb
CHANGED