Search code examples
phpcachingapc

how to exclude .php file from APC cache?


I cache top users data in a file named top_users.php, let us call it file cache.

But the APC will cache all the .php files, how to exclude some special .php file from APC

cache?


Solution

  • You can use filters in your apc config file:

    apc.filters = "-/usr/share/files/.*"
    

    This would not cache files under that match that pattern basically any file under that path /usr/share/files/

    For you, you could use:

    apc.filters = "-/my/share/top_users\.php"
    

    Check this out http://www.php.net/manual/en/apc.configuration.php#ini.apc.filters

    This assumes the file is being required or included by absolute path.