New Addon - Redis integration for caching


#1

Based on the concepts and idea of the SimpleResponseCache addon, it provides caching (configurable per API path or programmatically set/get) using Redis.

Keep in mind that may be useful only on some scenarios.


#2

Thanks for the contribution.

I would recommend using the memory service: https://github.com/agentejo/cockpit/blob/next/bootstrap.php#L193-L196

$this->app->memory->get({$key});
$this->app->memory->set({$key}, {$value});

which can be configured to use redis.

Greets,
Artur


#3

Thanks, I’ll take a look, do you have an example of configuration?


#4
memory:
   server: redis://153.202.124.2:6379
   options:
     prefix: myapp

#5

Oh cool, I’ll change the addon implementation to rely on it.


#6

The good thing is, that it will fallback to the sqlite based Redis implementation (https://github.com/agentejo/RedisLite) if you don’t configure the storage engine to be redis


#7

Sure, think it was great idea from the implementation perspective. But can see maybe one problem on using the internal memory set/get, I can’t set directly a ttl value!

Other question is, you are using the memory only to store non persistent data, correct?


#8

right, need to implement setex for that