What's the maximum key length for PHP APC?
Asked Answered
E

2

8

You would think this would be super-easy to find, but I can't seem to.

Exclude answered 5/5, 2011 at 0:30 Comment(0)
V
2

I really don't know PHP, but it looks like values are added using apc_add() or apc_store(), which take keys which are strings. I would infer that the maximum key length is therefore the maximum length of a string in PHP.

According to PHP: Strings,

Note: It is no problem for a string to become very large. PHP imposes no boundary on the size of a string; the only limit is the available memory of the computer on which PHP is running.

Verdha answered 5/5, 2011 at 0:36 Comment(1)
@Steve Clay: Agreed, and thanks for your actual answer. Very long keys are more likely to exhaust APC's allotted shared memory space (default=32M) before PHP (or even the system) runs out of memory.Nullity
P
7

There appears to be no limitation on key size/content.

Internally, keys are initialized via the C function apc_cache_make_user_key, which takes the given key string ("identifier") and stores it along with a hashed version.

Pareto answered 25/7, 2013 at 14:45 Comment(0)
V
2

I really don't know PHP, but it looks like values are added using apc_add() or apc_store(), which take keys which are strings. I would infer that the maximum key length is therefore the maximum length of a string in PHP.

According to PHP: Strings,

Note: It is no problem for a string to become very large. PHP imposes no boundary on the size of a string; the only limit is the available memory of the computer on which PHP is running.

Verdha answered 5/5, 2011 at 0:36 Comment(1)
@Steve Clay: Agreed, and thanks for your actual answer. Very long keys are more likely to exhaust APC's allotted shared memory space (default=32M) before PHP (or even the system) runs out of memory.Nullity

© 2022 - 2024 — McMap. All rights reserved.