Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

ApcCache::doContains should use apc_exists() instead of apc_fetch(). It ... #114

Closed
wants to merge 1 commit into from

5 participants

@slimacek

...makes a huge difference in execution time if stored value is large.

@slimacek slimacek ApcCache::doContains should use apc_exists() instead of apc_fetch(). …
…It makes a huge difference if stored value is large.
f3b8570
@schmittjoh schmittjoh commented on the diff
lib/Doctrine/Common/Cache/ApcCache.php
@@ -49,9 +49,7 @@ protected function doContains($id)
{
$found = false;
- apc_fetch($id, $found);
-
- return $found;
+ return apc_exists($id);
@schmittjoh Collaborator

This function was added in version "3.1.4" while "apc_fetch" exists since "3.0.0".

Do we make any guarantee what version of APC we support?

I could find nothing in the documentation regarding versions of APC. Due to that, this should probably be a change made in 2.3 and not 2.2.x. Alternatively, one could add a constructor which uses function_exists to set a variable function to use for doContains().

BTW this commit is messy, leaving the unused local variable $found in place.

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

If @slimacek is not around to finish this PR is it ok if I'll pick-up the work from where he stopped?

@stof
Collaborator

@dlsniper sure it is. simply base your work on his branch so that you keep his authorship

@dlsniper

@stof sorry but I'm clueless on how to do that, can you please send me a link or something that explains how to do it?
Can I simply add a new upstream then commit the changes to his branch? I've only did it so far with forking a certain repository after deleting my own fork but currently my fork has already a PR pending here....

@stof
Collaborator

Closing in favor of #124 which fixes the remaining stuff

@stof stof closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 12, 2012
  1. @slimacek

    ApcCache::doContains should use apc_exists() instead of apc_fetch(). …

    slimacek authored
    …It makes a huge difference if stored value is large.
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 3 deletions.
  1. +1 −3 lib/Doctrine/Common/Cache/ApcCache.php
View
4 lib/Doctrine/Common/Cache/ApcCache.php
@@ -49,9 +49,7 @@ protected function doContains($id)
{
$found = false;
- apc_fetch($id, $found);
-
- return $found;
+ return apc_exists($id);
@schmittjoh Collaborator

This function was added in version "3.1.4" while "apc_fetch" exists since "3.0.0".

Do we make any guarantee what version of APC we support?

I could find nothing in the documentation regarding versions of APC. Due to that, this should probably be a change made in 2.3 and not 2.2.x. Alternatively, one could add a constructor which uses function_exists to set a variable function to use for doContains().

BTW this commit is messy, leaving the unused local variable $found in place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
}
/**
Something went wrong with that request. Please try again.