aws icon indicating copy to clipboard operation
aws copied to clipboard

[DynamoDB] Cache Adapter for Symfony

Open ker0x opened this issue 4 years ago • 7 comments

Hello!

While reading the documentation, I didn't see any mention of the possibility to use the DynamoDB client as a cache adapter for Symfony.

However, seeing there is already one for Laravel, i though it could be great to add one for Symfony too. Is it something you would consider?

ker0x avatar Apr 29 '21 16:04 ker0x

Hello!

That is true. Should we add a PSR-6 compatible cache with DynamoDB? Sure, if you find it useful.

But is DynamoDB a good cache provider? Ie compared to Redis.

Nyholm avatar Apr 30 '21 06:04 Nyholm

But is DynamoDB a good cache provider? Ie compared to Redis.

tbh, idk, maybe i'm looking in the wrong direction, but here some context regarding my request:

I'm currently testing things with Symfony + Bref on AWS Lambda and i would like to setup some persistent cache. As I'm fairly new to AWS and serverless in general maybe DynamoDB is the wrong choice.

However, I could use this package but it require the whole AWS PHP SDK which seems a bit overkill for just using one service.

ker0x avatar Apr 30 '21 08:04 ker0x

Im running Symfony + Bref on AWS. The very best solution is to set up ElasticCache (Redis) and use symfony/cache' redis adapter.

You will need the extra php extension. I use a redis cluster any my DSN (used with Symfony) looks like this:

REDIS_CACHE_DSN='redis:?host[acme.zersin.clustercfg.euc1.cache.amazonaws.com]&lazy=true&redis_cluster=1'

Nyholm avatar Apr 30 '21 09:04 Nyholm

Thank you for your reply, i'll look into it.

ker0x avatar Apr 30 '21 09:04 ker0x

How did it work out for you?

Nyholm avatar May 13 '21 06:05 Nyholm

I updated the mentioned package to use async-aws instead of the full AWS SDK.

RikudouSage avatar Oct 05 '21 19:10 RikudouSage

But is DynamoDB a good cache provider? Ie compared to Redis.

@Nyholm I think it's a good solution. Depending on how you design your keys it's going to be pretty effing quick, (maybe as fast as Redis, i don't know?), and IMO it's the more 'serverless' way of doing things as you don't need to care about node sizes or paying for over-provisioned capacity at times that you have less traffic.

nealio82 avatar Oct 04 '22 08:10 nealio82

I'm closing this issue as this is implemented in https://github.com/RikudouSage/DynamoDbCachePsr6

stof avatar Jul 11 '23 07:07 stof