Skip to content

Where does the cached data go here? #16488

Closed Answered by niden
zubin999 asked this question in Q&A
Discussion options

You must be logged in to vote

Setting up the cache for a different adapter, in your case Redis, is very similar to what you have there

<?php

use Phalcon\Cache\Cache;
use Phalcon\Cache\AdapterFactory;
use Phalcon\Di\FactoryDefault;
use Phalcon\Storage\SerializerFactory;

$serializerFactory = new SerializerFactory();
$adapterFactory    = new AdapterFactory($serializerFactory);

$options = [
    'defaultSerializer' => 'Json',
    'lifetime'          => 7200,
    'host'              => '10.4.13.100',
    'port'              => 6379,
    'index'             => 1,
];

$adapter = $adapterFactory->newInstance('redis', $options);

$cache = new Cache($adapter);

https://docs.phalcon.io/5.4/cache/#redis

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

niden
Jan 3, 2024
Maintainer Sponsor

You must be logged in to vote
0 replies
Answer selected by zubin999
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants