Skip to content

Commit

Permalink
Changed the runtime configuration for the APCu extension; explicitly …
Browse files Browse the repository at this point in the history
…used a TTL value on apcu_store() calls
  • Loading branch information
avpaderno committed Feb 16, 2025
1 parent 5019b4f commit 20ccf3f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/simpletest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
with:
php-version: ${{ env.PHP_VERSION }}
extensions: apcu
ini-values: apc.enabled=1, apc.enable_cli=1, apc.shm_segments = 10, apc.shm_size = 256M
ini-values: apc.enabled=1, apc.enable_cli=1, apc.shm_size = 512M
coverage: none

- name: Set up Apache
Expand Down
4 changes: 2 additions & 2 deletions includes/apc_storage_lock.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class ApcStorageLock {

if (apcu_exists($this->key)) {
// Try to extend the expiration of an already acquired lock.
if (!apcu_store($this->key, array('expire' => $expire))) {
if (!apcu_store($this->key, array('expire' => $expire), 0)) {
// The lock was broken.
apcu_delete($this->key);

Expand All @@ -108,7 +108,7 @@ class ApcStorageLock {

// We always want to do this code at least once.
do {
$success = apcu_store($this->key, array('expire' => $expire));
$success = apcu_store($this->key, array('expire' => $expire), 0);

if (!$success) {
// If this is our first pass through the loop, then $retry is FALSE.
Expand Down
6 changes: 3 additions & 3 deletions includes/apc_storage_queue.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class ApcStorageQueue implements BackdropQueueInterface {
$item->item_id = ApcStorageHelper::uniqueId();
$item->expire = 0;

return apcu_store($this->queueKeyName($item), $item);
return apcu_store($this->queueKeyName($item), $item, 0);
}

return FALSE;
Expand Down Expand Up @@ -95,7 +95,7 @@ class ApcStorageQueue implements BackdropQueueInterface {
if ($item['value']->expire == 0) {
$item['value']->expire = time() + $lease_time;

if (apcu_store($item['key'], $item['value'])) {
if (apcu_store($item['key'], $item['value'], 0)) {
return $item['value'];
}
}
Expand All @@ -121,7 +121,7 @@ class ApcStorageQueue implements BackdropQueueInterface {
$item->expire = 0;

if (extension_loaded('apcu') && apcu_enabled()) {
return apcu_store($this->queueKeyName($item), $item);
return apcu_store($this->queueKeyName($item), $item, 0);
}

return FALSE;
Expand Down

0 comments on commit 20ccf3f

Please sign in to comment.