Cache gets and cache sets

Created on 17 April 2017, over 7 years ago
Updated 9 August 2024, 4 months ago

Hi.

my configuration:

$conf['cache_backends'][] = 'sites/all/modules/apc/drupal_apc_cache.inc';
$conf['cache_class_cache'] = 'DrupalAPCCache';
$conf['cache_class_cache_bootstrap'] = 'DrupalAPCCache';
$conf['apc_show_debug'] = TRUE;

PHP5.6 with APCu enabled. Installation went well and status report is ok.

I am trying to figure out what benefit this module gives. With debug mode enabled I get the reports like one quoted at the bottom.

After reloading the same page the report is still the same.

I would expect to see much more "Get"s that "Set"s in report at reload. However, it seems that for each "cache get" there is also matching "cache set" immediately after or soon behind cache get. Why this module calls "cache set" for cache records which it gets through "cache get" already?

Also at Status report there is always the statement that APC cache is running for just last few seconds:

APCu 4.0.11
APCu has been running for 3 sec. Currently caching 11 entries (407.86 KB).

I would expect cache to run longer and not to hit so many cache sets over and over again.

Any help / idea? Is this all normal? Or my APC cache is restarted on each page request for some reason?

APC statistics
Type Bin Cid(s)
get cache_bootstrap variables
set cache_bootstrap variables
get cache_bootstrap bootstrap_modules
set cache_bootstrap bootstrap_modules
get cache_bootstrap lookup_cache
get cache_bootstrap variable:language:hr
set cache_bootstrap variable:language:hr
get cache_bootstrap system_list
set cache_bootstrap system_list
get cache_bootstrap module_implements
get cache_bootstrap hook_info
set cache_bootstrap hook_info
clear cache_bootstrap variables 0
get cache entity_info:en
get cache node_types:en
set cache node_types:en
get cache paragraphs_bundles
set cache paragraphs_bundles
get cache schema:runtime:1
get cache schema
get cache_bootstrap system_list
set cache schema
set cache entity_info:en
get cache entity_property_info:en
get cache ctools_plugin_type_info
set cache ctools_plugin_type_info
get cache ctools_plugin_files:entityreference:behavior
set cache ctools_plugin_files:entityreference:behavior
set cache entity_property_info:en
get cache filter_list_format
set cache filter_list_format
get cache theme_registry:runtime:multipurpose
get cache theme_registry:multipurpose
get cache theme_registry:build:modules
set cache ctools_plugin_files:ctools:content_types
get cache filter_formats:en
set cache filter_formats:en
set cache theme_registry:build:modules
set cache theme_registry:multipurpose
get cache theme_registry:runtime:multipurpose
set cache theme_registry:runtime:multipurpose
set cache_bootstrap lookup_cache
set cache_bootstrap module_implements

💬 Support request
Status

Fixed

Component

Miscellaneous

Created by

🇭🇷Croatia devad

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    This module does not set a new cache item each time a cache item is read. That is a module that first retrieve a value from the cache and then it updates it, which perfectly fine for functions like variable_initialize(). During the bootstrap, I would expect it to happen often, with different cache items.

    As for why it always says it was started three seconds ago, that is because APCu is intended to function in a prefork multiprocess, or multithreaded SAPI. See APCu doesn't store in PHP 7.
    I tested on my site, which uses litespeed as SAPI: Values are not preserved between requests and APCu says it just started a few seconds before the page is loaded.

  • Status changed to Fixed 4 months ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024