From 8af80c5011124b65bafb00d5f2d3da98b0848613 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Wed, 29 Nov 2023 11:36:26 -0600 Subject: [PATCH] CACHEBOX-85 #resolve Remove Lock and Double `get` from getOrSet --- box.json | 2 +- system/cache/AbstractCacheBoxProvider.cfc | 32 ++++++++--------------- 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/box.json b/box.json index 20bee1cf6..c4126477e 100644 --- a/box.json +++ b/box.json @@ -1,6 +1,6 @@ { "name":"ColdBox Platform", - "version":"7.3.0", + "version":"7.2.1", "location":"https://downloads.ortussolutions.com/ortussolutions/coldbox/@build.version@/coldbox-@build.version@.zip", "author":"Ortus Solutions ", "slug":"coldbox", diff --git a/system/cache/AbstractCacheBoxProvider.cfc b/system/cache/AbstractCacheBoxProvider.cfc index a0260e66f..00642a441 100644 --- a/system/cache/AbstractCacheBoxProvider.cfc +++ b/system/cache/AbstractCacheBoxProvider.cfc @@ -394,27 +394,17 @@ component accessors=true serializable=false { return target; } - // else, produce it - lock - name ="GetOrSet.#variables.cacheID#.#arguments.objectKey#" - type ="exclusive" - timeout ="45" - throwonTimeout="true" { - // double lock, due to race conditions - var target = get( 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 - ); - } - } + // produce it + target = arguments.produce(); + + // store it + set( + objectKey = arguments.objectKey, + object = target, + timeout = arguments.timeout, + lastAccessTimeout = arguments.lastAccessTimeout, + extra = arguments.extra + ); return target; }