3

I'm new to php and using APC framework. I'm trying to write some unit tests for a class that uses APC, but I'm running in to some problems trying to delete and then set some key values again in APC. My problem can be boiled down to a small set of code not working the way I would expect:

$success = apc_store("helloWorld", 2, 0);  // true
$success1 = apc_delete("helloWorld");      // true
$success2 = apc_store("helloWorld", 3, 0); // false

In addition doing a fetch call on "helloWorld" will return NULL, and I get the warning:

[apc-warning] Potential cache slam averted for key 'helloWorld'

In addition I have tried to add this to my php.ini file:

apc.enable_cli=ON

I have also tried to increase the memory limit from the default 32M to 64M by adding this to my php.ini file:

apc.shm_size = 64M

I found this related question on in Why would apc_store() return false?, but neither suggestion worked me me though.

How can I fix this so that the expected three trues are returned? Why are they not being returned?

Community
  • 1
  • 1

1 Answers1

1

Your example code works perfectly for me (true/true/true) in PHP 5.3.12 with apc 3.1.9, so maybe you should try a later version?

Synchro
  • 35,538
  • 15
  • 81
  • 104