Benjamin Fleischer
35a7c81034
Fix up caching, especially fragment_cache
2016-06-07 00:52:05 -05:00
Benjamin Fleischer
913f396bb1
Move adapter cache properties to class level (where they belong).
2016-06-04 15:00:51 -05:00
Benjamin Fleischer
385abb4ba0
Simplify Serializer#cached_attributes to take a fields argument
2016-06-01 01:02:17 -05:00
Benjamin Fleischer
ba23de686d
Complete extracting to Serializer#cached_attributes
2016-06-01 01:02:13 -05:00
Benjamin Fleischer
96750b2f9a
Remove unnecessary Serializer#cached_fields
2016-06-01 00:47:10 -05:00
Lucas Hosseini
f48fd2a327
Extract IncludeTree. ( #1685 )
2016-05-28 10:07:11 -04:00
Benjamin Fleischer
1d24c9708a
Lazify calculating caller file digest until used
2016-04-18 12:04:31 -05:00
Benjamin Fleischer
cc80eba9c9
Refactor fragment cache logic some more
2016-04-13 01:08:10 -05:00
Benjamin Fleischer
06636b25b2
Begin simplifying fragment cache
2016-04-13 01:08:09 -05:00
Benjamin Fleischer
1e10c20ac0
Consolidate and simplify caching code
2016-04-13 01:08:09 -05:00
Benjamin Fleischer
21b2eff2ab
Improvements from Rails plugin template
2016-04-01 05:39:03 -05:00
kevintyll
16a3f93ce9
Include adapter in cache key
...
Confirm caching attributes with different key json_api vs. attributes adapter
Adapted from @kevintyll's original test
https://github.com/rails-api/active_model_serializers/pull/1644#issuecomment-204147094
2016-04-01 00:52:28 -05:00
Benjamin Fleischer
4ba4c298ec
Prefer object.cache_key when available.
2016-03-31 22:29:13 -05:00
kevintyll
ab6bd600e3
When caching, return the object's cache_key up front if it's defined.
...
This will prevent objects PORO objects that don't have updated_at defined, from throwing an error.
Not as big a deal now that PORO objects can inherit ActiveModelSerializers::Model, but still necessary if it's not inherited for whatever reason.
Add the Adapter type to the cache key.
This prevents incorrect results when the same object is serialized with different adapters.
BF:
Cherry-pick of
040a97b9e9
which was a squash of
f89ed71058
from pr 1346
2016-03-31 22:29:13 -05:00
Benjamin Fleischer
dd60a371ae
Simplify caching of value of config.perform_caching
2016-03-24 22:22:19 -05:00
Benjamin Fleischer
c3c69a607a
Separate enabling of caching and setting the cache store
2016-03-24 22:20:42 -05:00
Benjamin Fleischer
9953d7abe0
Trigger callback to set serializer#_cache when controller loaded
2016-03-24 22:20:42 -05:00
Benjamin Fleischer
a26d3e4425
Rubocop autocorrect
2016-03-08 22:32:34 +01:00
Lucas Hosseini
fd06a8ad0d
Extract caching into its own module.
2015-12-28 02:53:49 +01:00