APC User Cache Key collisions on multiple sites

筅森魡賤 提交于 2019-12-24 17:37:50

问题


What's the best option for avoiding key collisions between multiple sites running on the same server using APC for user caching?

I've run into issues where 2 or more sites were using the same cache key and expecting different types of items to be stored under it--one expecting a json string, the other an array, another an object.

Is their a way to segment APC by site?

BTW: I'm using APC with Apache running prefork and mod_php.


回答1:


Perhaps you could append the server hostname to the key, you could define a constant or create some model for handling your APC:

<?php 
define('APC_HOST_KEY',$_SERVER['HTTP_HOST']);

apc_store(APC_HOST_KEY.'_value_key', $value);
?>


来源:https://stackoverflow.com/questions/13291244/apc-user-cache-key-collisions-on-multiple-sites

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!