Skip to content

Commit

Permalink
Issue #1342: try to make the note about in-memory cache more clear
Browse files Browse the repository at this point in the history
in-memory cache keeps references as they are
in-backend cache follows references and keeps a snapshot of the current value
  • Loading branch information
bschmalhofer committed Nov 5, 2021
1 parent 039fe9f commit 815731d
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions Kernel/System/Cache.pm
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,10 @@ The Key identifies the entry (together with the type) for retrieval and deletion
The C<TTL> controls when the cache will expire. Please note that the in-memory cache is not persistent
and thus has no C<TTL>/expiry mechanism.
Please note that if you store complex data, you have to make sure that the data is not modified
in other parts of the code as the in-memory cache only refers to it. Otherwise also the cache would
contain the modifications. If you cannot avoid this, you can disable the in-memory cache for this
value:
Please note that if you store complex data you have to make sure that the data is not modified
in other parts of the code. This is because the in-memory cache stores the passed references as references.
Otherwise the cache would also contain the modifications. An example for such complex data is a reference to a scalar.
If you cannot avoid this, you can disable the in-memory cache for this particular value.
$CacheObject->Set(
Type => 'ObjectName',
Expand Down Expand Up @@ -271,16 +271,15 @@ fetch a value from the cache.
Key => 'SomeKey',
);
Please note that if you store complex data, you have to make sure that the data is not modified
in other parts of the code as the in-memory cache only refers to it. Otherwise also the cache would
contain the modifications. If you cannot avoid this, you can disable the in-memory cache for this
value:
Please note that if you store complex data you have to make sure that the data is not modified
in other parts of the code. This is because the in-memory cache stores the passed references as references.
Otherwise the cache would also contain the modifications. An example for such complex data is a reference to a scalar.
If you cannot avoid this, you can disable the in-memory cache for this particular value.
my $Value = $CacheObject->Get(
Type => 'ObjectName',
Key => 'SomeKey',
CacheInMemory => 0, # optional, defaults to 1
Type => 'ObjectName',
Key => 'SomeKey',
CacheInMemory => 0, # optional, defaults to 1
CacheInBackend => 1, # optional, defaults to 1
);
Expand Down

0 comments on commit 815731d

Please sign in to comment.