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
I'm getting "Serialization of Closure is not allowed" in concrete5 which uses Stash. This happens because objects stored in or returned by Empheral are a reference and any changes to the original/returned item also alters the stored instance in cache.
Therefore requesting the same cached item twice might result in different returned values even though the key has not been altered through a regular Stash set function.
This might be intended behaviour, although I don't feel it is really intuitive. It was suggested in the issue (concretecms/concretecms#6113) that this could be something that can be changed in Stash as well.
footnote: concrete5 clones objects before caching in Stash, but retrieves the cached instance without cloning. So the problem is less apparent there.
The text was updated successfully, but these errors were encountered:
Ruud-Zuiderlicht
changed the title
Serialization of Closure is not allowed
Cached instances of objects can be altered outside of Stash
Jan 30, 2018
I believe the common pattern is to always return a clone of the cached object, whether it's from an in-memory array cache, or an "external" cache. Decoupling this from the adapter would, however, require using proxies for the get methods (that call the adapter implementation + do the cloning).
I'm getting "Serialization of Closure is not allowed" in concrete5 which uses Stash. This happens because objects stored in or returned by Empheral are a reference and any changes to the original/returned item also alters the stored instance in cache.
Therefore requesting the same cached item twice might result in different returned values even though the key has not been altered through a regular Stash
set
function.This might be intended behaviour, although I don't feel it is really intuitive. It was suggested in the issue (concretecms/concretecms#6113) that this could be something that can be changed in Stash as well.
footnote: concrete5 clones objects before caching in Stash, but retrieves the cached instance without cloning. So the problem is less apparent there.
The text was updated successfully, but these errors were encountered: