redis not setting expire time
hi, i have a redis instance in a project that is not setting the ttl when setting value in the cache
here's an example of my code
i'm using nestjs with "@nestjs/cache-manager": "^2.2.2"
to check i did:
in railway's dashboard β redis instance β data, keys have "no expiry" and via redis-cli connecting to the instance deployed in railway. i also then tested by setting and expire second in the railway's dasboard and the checking if there was a TTL for that key via redis-cli and it had. then runned in my local env with a local redis instance, checked the keys via redis-cli, also TTL was correctly set
i have the same configuration and code in other projects hosted in AWS and Render. there works perfect, here just don't, would be nice to have help for the Railway team π
Solution:Jump to solution
@Brody you were right, no idea exactly why this happens, but it's a problem with the cache-manager from v4 to v5
i solved it by doing
```
await this.cache.set(phoneNumber, conversationState, { ttl: 60 * 60 * 2 } as any); // 2 hours expiration...
5 Replies
Project ID:
367c8848-a813-4e35-a994-6367d8702c73
367c8848-a813-4e35-a994-6367d8702c73
This would indicate an issue with the cache-manager package or how you have it setup, something like it being incompatible with the version of Redis that is deployed on Railway, Railway deploys a bog standard Redis database with nothing special going on so this wouldn't be an issue with Redis or the platform
Solution
@Brody you were right, no idea exactly why this happens, but it's a problem with the cache-manager from v4 to v5
i solved it by doing
thanks for your help π€
in the future please keep an open mind when someone says that it isn't a platform issue
also noticed you opened a private thread, please do not open private threads unless you need to share sensitive information with the team, it is not for personal development support