🌐 AI搜索 & 代理 主页
Skip to content

Conversation

@vtsykun
Copy link
Contributor

@vtsykun vtsykun commented Sep 8, 2023

Q A
Branch? 6.4
Bug fix? no
New feature? yes
Deprecations? no
Tickets Fix #45599
License MIT
Doc PR -

This PR allow colon char : in cache key. It may be useful for redis grouping keys by pattern without creating a many pools for each namespace.

Difference between implementation #47561

  • colon is only allowed for Symfony contracts cache, the PSR-6/16 adapters keeps this validation as before.
  • Allow colon in namespace name too

@carsonbot carsonbot added this to the 6.4 milestone Sep 8, 2023
@vtsykun vtsykun force-pushed the feat/cache-1 branch 2 times, most recently from 24881eb to 94ec24f Compare September 9, 2023 11:28
}
if (false !== strpbrk($key, self::RESERVED_CHARACTERS)) {
throw new InvalidArgumentException(sprintf('Cache key "%s" contains reserved characters "%s".', $key, self::RESERVED_CHARACTERS));
$reservedChars = null === $allowChars ? self::RESERVED_CHARACTERS : str_replace(str_split($allowChars), '', self::RESERVED_CHARACTERS);
Copy link
Member

Choose a reason for hiding this comment

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

would it be possible to get rid of the calls to str_replace and str_split? this is on the hotpath and we'd better make this as fast as possible

return $this->namespace.$this->namespaceVersion.$this->ids[$key];
}
\assert('' !== CacheItem::validateKey($key));
\assert('' !== CacheItem::validateKey($key, static::NS_SEPARATOR));
Copy link
Member

Choose a reason for hiding this comment

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

this one is used for PSR-6 also, isn't it?

@nicolas-grekas nicolas-grekas modified the milestones: 6.4, 7.1 Nov 15, 2023
@nicolas-grekas
Copy link
Member

@vtsykun up to resume this PR?

@dorrogeray
Copy link
Contributor

It would be great to have this feature 👍 I can try to pick up this PR @vtsykun if you are too busy.

@nicolas-grekas
Copy link
Member

@dorrogeray follow up PR welcome then!

@dorrogeray
Copy link
Contributor

@nicolas-grekas I will work on it this week.

@xabbuh xabbuh modified the milestones: 7.1, 7.2 May 15, 2024
@fabpot fabpot modified the milestones: 7.2, 7.3 Nov 20, 2024
@nicolas-grekas
Copy link
Member

Closing in favor of #59813, thanks for giving this a try!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Cache] Allow colon in key key (with redis at least)

6 participants