Skip to content

Update PSR-Cache.md#14

Open
RichardLynch wants to merge 1 commit intotedivm:Cachefrom
RichardLynch:patch-1
Open

Update PSR-Cache.md#14
RichardLynch wants to merge 1 commit intotedivm:Cachefrom
RichardLynch:patch-1

Conversation

@RichardLynch
Copy link

Suppose you have a Drupal plugin that uses PSR-Cache and is configured to use, say, APC.

Then you add, say, a Symfony app that also uses APC.

There are bound to be key collisions here.

I would propose a "prefix" property and a composeKey ($key) { return $this->prefix . $key; }

This would allow each app to have their own configurable prefix providing a namespace.

It still doesn't guarantee two children won't use the same prefix . $key, but at least it gives the developers a sensible way out of the dilemma.

Frameworks could have standards to reduce the probability of collision. Ex, Drupal could standardize on 'Drupal_Modulename_site' as the default.

The 'site' part covers multisite.

Suppose you have a Drupal plugin that uses PSR-Cache and is configured to use, say, APC.

Then you add, say, a Symfony app that also uses APC.

There are bound to be key collisions here.

I would propose a "prefix" property and a composeKey ($key) { return $this->prefix . $key; }

This would allow each app to have their own configurable prefix providing a namespace.

It still doesn't guarantee two children won't use the same prefix . $key, but at least it gives the developers a sensible way out of the dilemma.

Frameworks could have standards to reduce the probability of collision. Ex, Drupal could standardize on 'Drupal_Modulename_site' as the default.

The 'site' part covers multisite.
@tedivm
Copy link
Owner

tedivm commented May 21, 2013

You can't have "private" or "protected" fields inside of an interface, it'll throw an error.

This type of detail is very, very important, but it falls more onto the implementing library to handle. We talked a bit about adding a "namespace" field into this version of the interface but it was rejected as too complicated by the group.

tedivm pushed a commit that referenced this pull request Oct 16, 2013
Anglicisimos entre ``
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.

2 participants