diff --git a/platform/persistence/cache/src/CachingPersistenceDecorator.js b/platform/persistence/cache/src/CachingPersistenceDecorator.js index 9ca964637e..3f2705c428 100644 --- a/platform/persistence/cache/src/CachingPersistenceDecorator.js +++ b/platform/persistence/cache/src/CachingPersistenceDecorator.js @@ -21,16 +21,10 @@ define( var spaces = CACHE_SPACES || [], // List of spaces to cache cache = {}; // Where objects will be stored - // Utility function; avoid sharing one instance everywhere. - function clone(value) { - // Only clone truthy values (no need to clone undefined, false...) - return value && JSON.parse(JSON.stringify(value)); - } - // Place value in the cache for space, if there is one. function addToCache(space, key, value) { if (cache[space]) { - cache[space][key] = { value: clone(value) }; + cache[space][key] = { value: value }; } } @@ -110,7 +104,7 @@ define( */ readObject: function (space, key) { return (cache[space] && cache[space][key]) ? - fastPromise(clone(cache[space][key].value)) : + fastPromise(cache[space][key].value) : persistenceService.readObject(space, key) .then(putCache(space, key)); },