FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Use unique names for queue unique cache configurations by sheldonreiff · Pull Request #120 · cakephp/queue · GitHub

/ queue Public

Use unique names for queue unique cache configurations - #120

Merged
markstory merged 1 commit into
cakephp:masterfrom
sheldonreiff:use-unique-name-for-cache-configurations
Mar 14, 2023
Merged

Use unique names for queue unique cache configurations#120
markstory merged 1 commit into
cakephp:masterfrom
sheldonreiff:use-unique-name-for-cache-configurations

Conversation

Copy link
Copy Markdown
Contributor

Prevents an exception when multiple configs are set with uniqueCache configured.

Fixes #113

sheldonreiff force-pushed the use-unique-name-for-cache-configurations branch from 837af4c to 90590d7 Compare March 10, 2023 22:23
sheldonreiff force-pushed the use-unique-name-for-cache-configurations branch from 90590d7 to e87fe35 Compare March 10, 2023 23:03
markstory added this to the 1.0.0 milestone Mar 13, 2023
Comment thread src/QueueManager.php
$cacheConfig = array_merge($cacheDefaults, $config['uniqueCache']);

Cache::setConfig('Cake/Queue.queueUnique', $cacheConfig);
$config['uniqueCacheKey'] = "Cake/Queue.queueUnique.{$key}";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Couldn't this be put into the defaults so that userland code can define it if they really need to?

$cacheDefaults` = [
  'duration' => '+24 hours',
  'uniqueCacheKey' => "Cake/Queue.queueUnique.{$key}"
];

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

The whole array nested under uniqueCache is passed directly through to Cache::setConfig(), so maybe that would be slightly confusing that uniqueCacheKey isn't part of the cache config? We could bump it up a level though and let it be configurable as part of the main config. So configuring the unique cache would look like this:

'uniqueCacheKey' => 'someCustomKey', // (optional)
'uniqueCache' => [
    'engine' => 'File',
],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

maybe that would be slightly confusing that uniqueCacheKey isn't part of the cache config?

Yeah that would be odd. Lets roll with what you have so far. If we come up with use-cases that require custom cache key configuration control we can revisit then.

markstory merged commit 75db394 into cakephp:master Mar 14, 2023
sheldonreiff deleted the use-unique-name-for-cache-configurations branch March 17, 2023 17:31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

QueueManager Fails when Multiple Queue Configs Contain uniqueCache Key

2 participants


Back | FazBrowse Home | New Git URL