Anders Lars
05/01/2023, 5:10 PM// Create a Redis client object
redis = createObject("java", "redis.clients.jedis.Jedis").init("localhost")
// Define the key and value to be written to the Redis cache
key = "myKey"
value = "myValue"
// Acquire a distributed lock for the key
lockName = "redis_lock_" & key
lockTimeout = 5000 // Lock timeout in milliseconds
lock = cfdistributedlock.acquire(lockName, lockTimeout)
// If the lock is acquired successfully, write the value to the Redis cache
if (lock.isAcquired()) {
redis.set(key, value)
// Release the lock
lock.release()
} else {
writeOutput("Failed to acquire lock for key: " & key)
}Patrick
05/01/2023, 6:35 PMAnders Lars
05/01/2023, 9:28 PMDistributedLock name=name cache=cacheName expires=1 timeout=5 {
cachePut(key, data);
}
will test it out shortlyAnders Lars
05/02/2023, 2:34 AMdilo:redis-dilo-23-59-17-E65:open
that has a TTL of 'No Limit'
So doesn't look like release is getting called with the syntax above. And obviously the dilo entries all just stay there, mounting up.zackster
05/02/2023, 9:39 AMAnders Lars
05/02/2023, 3:10 PMzackster
05/02/2023, 3:44 PMAnders Lars
05/02/2023, 3:49 PMzackster
05/02/2023, 4:02 PMAnders Lars
05/02/2023, 4:13 PM