New Addon - Redis integration for caching

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.

1 Like

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

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

memory:
   server: redis://153.202.124.2:6379
   options:
     prefix: myapp
1 Like

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

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

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?

right, need to implement setex for that