You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17-6Lines changed: 17 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,8 @@ end
30
30
31
31
_*This is already done for you in Rails_
32
32
33
-
Then declare some cache finder methods. Cached finders can be defined for individual fields or defined as composites for mulitple fields
33
+
Then declare some cache finder methods. Cached finders can be defined for individual fields or defined as composites for
34
+
multiple fields
34
35
35
36
```ruby
36
37
classCustomer < ::ActiveRemote::Base
@@ -42,7 +43,8 @@ class Customer < ::ActiveRemote::Base
42
43
end
43
44
```
44
45
45
-
Now that you have a model that has cached finders on it you can use the `cached_search`, `cached_find`, or dynamic cached finder methods on the model to use the cache before you issue the AR search/find method.
46
+
Now that you have a model that has cached finders on it you can use the `cached_search`, `cached_find`, or dynamic
47
+
cached finder methods on the model to use the cache before you issue the AR search/find method.
ActiveRemote::Cached relies on an ActiveSupport::Cache-compatible cache provider. The cache is initialized with a simple memory store (defaults to 32MB), but can be overridden via `ActiveRemote::Cached.cache`:
67
+
ActiveRemote::Cached relies on an ActiveSupport::Cache-compatible cache provider. The cache is initialized with a simple
68
+
memory store (defaults to 32MB), but can be overridden via `ActiveRemote::Cached.cache`:
|`:race_condition_ttl`|`5.seconds`| See [ActiveSupport::Cache::Store documentation](https://api.rubyonrails.org/classes/ActiveSupport/Cache/Store.html)|
89
+
|`:expires_in`|`5.minutes`| See [ActiveSupport::Cache::Store documentation](https://api.rubyonrails.org/classes/ActiveSupport/Cache/Store.html)|
90
+
|`:handle_cache_error`|`false`| When true, cache errors will be handled and optionally sent to handler and return value will be as if cache missed, when cache errors will raise to application |
91
+
|`:cache_error_proc`|`nil`| Can be a proc that accepts a single value, the cache error raised, to be used in any kind of error handling you might want |
82
92
83
93
#### Local overrides
84
94
85
-
Each finder as takes an optional options hash that will override the options passed to the caching provider (override from the global defaults setup for ActiveRemote::Cached)
95
+
Each finder takes an optional options hash that will override the options passed to the caching provider (override from
96
+
the global defaults setup for ActiveRemote::Cached)
0 commit comments