Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Proposal for an object cache #11

Closed
wants to merge 17 commits into
from

Conversation

Projects
None yet
6 participants
Contributor

evert commented Dec 14, 2011

No description provided.

@beberlei beberlei and 1 other commented on an outdated diff Jan 30, 2012

proposed/objectcache.md
+ * Check if the key exists in the cache.
+ *
+ * @param string $key
+ * @return boolean
+ */
+ function exists($key);
+
+ /**
+ * Clears the entire cache.
+ *
+ * Implementations may choose to ignore this. What happens in this case
+ * is up to the implementor.
+ *
+ * @return void
+ */
+ function clear();
@beberlei

beberlei Jan 30, 2012

Should not be on the interface imho. Given namespacing of cache keys the behavior even inside the same cache implementation is undefined. We shouldn't give users somethings that can't be trusted. We removed this method from Doctrine cache because of this.

@evert

evert Jan 30, 2012

Contributor

On Jan 30, 2012, at 7:49 AM, Benjamin Eberlei wrote:

  •     \* Check if the key exists in the cache.
    
  •     *
    
  •     \* @param string $key
    
  •     \* @return boolean
    
  •     */
    
  •    function exists($key);
    
  •    /**
    
  •     \* Clears the entire cache.
    
  •     *
    
  •     \* Implementations may choose to ignore this. What happens in this case
    
  •     \* is up to the implementor.
    
  •     *
    
  •     \* @return void
    
  •     */
    
  •    function clear();
    

Should not be on the interface imho. Given namespacing of cache keys the behavior even inside the same cache implementation is undefined. We shouldn't give users somethings that can't be trusted. We removed this method from Doctrine cache because of this.

I did feel this way about clear(), which is why I added the disclaimer in the signature.. Why for exists() though?

Evert

@evert

evert Jan 30, 2012

Contributor

Whoops.. the way the email was formatted it seemed like you were talking about exists() and clear(), but now I see that doesn't make as much sense.

We're been having all disucssions in this group:

http://groups.google.com/group/php-standards

Perhaps you feel like joining there and repeating your point?

Any reason the interface is called 'Base' instead of the more expressive 'Cache' ? Same goes for 'Multiple' => MultipleCache.

Owner

evert replied Feb 18, 2012

There's been some discussion around naming on the mailing list.

Contributor

norv commented May 26, 2012

I really don't think defining an exists() on the cache is a good idea, in particular for a standard and a reference implementation of it. Because mainly of the reasons outlined by yourself as well as others, on making the implementations prone to race conditions.

If anything, the standard and its reference implementation should not promote (or enable too easily) buggy practices, at this level we're talking about here. (one I'm just pulling out of the legacy code...). And anyway, logically speaking, the result returned by exists() is simply not to be relied upon for more than strictly the moment of the call return, which is very error prone.

If exists() information is really needed - needed from the standard cache interface(s) - then probably the best way to provide it is through the discussed CacheEntry class, or CacheItem/CacheRecord as it's called in the alternative implementation.

Hi @evert

If you still support the proposal I've came up with you, php-fig/fig-standards#63 then should this still be opened?

Thank you!

Contributor

evert commented Mar 12, 2013

Closed this in favor of : #96

@dragoonis dragoonis closed this Apr 22, 2013

sun pushed a commit to sun/fig-standards that referenced this pull request May 18, 2014

Merge pull request #11 from joncave/patch-1
Remove extraneous lines from null keyword example

moufmouf pushed a commit to moufmouf/fig-standards that referenced this pull request Feb 29, 2016

Merge pull request #11 from moufmouf/container-configuration
Adding new feature to be ranked: ability to debug

michaelcullum pushed a commit that referenced this pull request Oct 19, 2017

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