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
LockAndCache.lock_and_cache(:stock_price, {company:'MSFT', date:'2015-05-05'}, expires:10, nil_expires:1, bypass::cache) do
157
+
# ignore any cached value, get yer stock quote
158
+
end
159
+
```
160
+
161
+
```ruby
162
+
LockAndCache.lock_and_cache(:stock_price, {company:'MSFT', date:'2015-05-05'}, expires:10, nil_expires:1, bypass::lock) do
163
+
# return cached value if it exists, otherwise get yet stock quote *without* acquiring lock
164
+
end
165
+
```
166
+
167
+
```ruby
168
+
LockAndCache.lock_and_cache(:stock_price, {company:'MSFT', date:'2015-05-05'}, expires:10, nil_expires:1, bypass::both) do
169
+
# get yer stock quote without caching or locking
170
+
end
171
+
```
172
+
153
173
#### Context mode
154
174
155
175
"Context mode" simply adds the class name, method name, and context key (the results of `#id` or `#lock_and_cache_key`) of the caller to the cache key.
@@ -234,6 +254,6 @@ You can expire nil values with a different timeout (`nil_expires`) than other va
234
254
4. Push to the branch (`git push origin my-new-feature`)
0 commit comments