diff --git a/system/cache/AbstractCacheBoxProvider.cfc b/system/cache/AbstractCacheBoxProvider.cfc index 00642a441..9d184d7d4 100644 --- a/system/cache/AbstractCacheBoxProvider.cfc +++ b/system/cache/AbstractCacheBoxProvider.cfc @@ -394,17 +394,26 @@ component accessors=true serializable=false { return target; } - // produce it - target = arguments.produce(); - - // store it - set( - objectKey = arguments.objectKey, - object = target, - timeout = arguments.timeout, - lastAccessTimeout = arguments.lastAccessTimeout, - extra = arguments.extra - ); + lock + name ="GetOrSet.#variables.cacheID#.#arguments.objectKey#" + type ="exclusive" + timeout ="45" + throwonTimeout="true" { + // double production check + var target = getQuiet( arguments.objectKey ); + if ( isNull( local.target ) ) { + // produce it + target = arguments.produce(); + // store it + set( + objectKey = arguments.objectKey, + object = target, + timeout = arguments.timeout, + lastAccessTimeout = arguments.lastAccessTimeout, + extra = arguments.extra + ); + } + } return target; }