Skip to content

Commit 7c931ff

Browse files
authored
DOCSP-44184: cache version method (#121)
* DOCSP-44184: cache version method * highlighting
1 parent 0f91d0e commit 7c931ff

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

source/index.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
.. _mongoid-odm-landing:
22
.. _mongoid-odm:
33

4-
================================
4+
====================================
55
{+odm+}: The ODM for MongoDB in Ruby
6-
================================
6+
====================================
77

88
.. toctree::
99
:titlesonly:

source/whats-new.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,26 @@ fixes:
3030
as raw hashes. To learn more, see the :ref:`mongoid-raw-results`
3131
section of the Modify Query Results guide.
3232

33+
- Improves caching functionality by modifying the behavior of
34+
``cache_key`` to *not* embed a timestamp when ``cache_version``
35+
returns a non-nil value. Instead, the timestamp is used as the version
36+
for the entry to reduce key churn.
37+
38+
This change also adds the ``cache_version`` method to the
39+
``Mongoid::Document`` module. If the cache key format introduced in
40+
this version poses an issue in your application, you can revert to
41+
the original format by defining the ``cache_version`` method as
42+
``nil``:
43+
44+
.. code-block:: ruby
45+
:emphasize-lines: 3
46+
47+
module Mongoid
48+
module Document
49+
def cache_version = nil
50+
end
51+
end
52+
3353
.. _mongoid-version-9.0:
3454

3555
What's New in 9.0

0 commit comments

Comments
 (0)