我有一个Symfony应用程序,我想使用Redis作为缓存系统。Symfony的默认缓存系统是文件系统缓存。
从我了解到的文档中,在Symfony中有两个名为缓存的缓存:cache.app和cache.system,因此我使用以下cache.yaml将两者设置为Redis:
framework:
cache:
# Put the unique name of your app here: the prefix seed
# is used to compute stable namespaces for cache keys.
prefix_seed: myte
我希望将PDO结果存储在redis缓存中,因此从我收集的在线资源中,我可以这样做。
$domain = 'www.example.com';
function getStat($domain) {
global $pdo;
global $redis;
$statement = "SELECT * FROM mc_visitor_session WHERE website = \'$domain\'";
$hash = md5($statement);
if (!$redis->get($hash . '-cache
在文件上写着
/// The cache manager must have at least one cache handle configured with <see cref="CacheHandleConfiguration.IsBackplaneSource"/> set to <c>true</c>.
/// Usually this is the redis cache handle, if configured. It should be the distributed and bottom most cach
我目前正在使用Redis在我的Laravel应用程序中提供缓存内容。我注意到在Cache Facade中使用它比使用原生Redis命令和要慢。我想用一个实现Redis外观的代码段来替换这个代码段。
public function setImageCached(Request $request)
{
$img = Cache::remember('image_'.$request->url, 6000, function () use ($request) {
return file_get_contents($request->url);