What are the Slack Archives?

Itโ€™s a history of our time together in the Slack Community! Thereโ€™s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you wonโ€™t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

Does Spryker provide any way to do a `TTL` command on a redis key?

UK5DS29L2
UK5DS29L2 Posts: 546 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet

Does Spryker provide any way to do a TTL command on a redis key?

Comments

  • schoenfeld
    schoenfeld Solution Architect Posts: 28 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet
    edited January 2020

    I dont know any command for that. But if you need to clean up redis, maybe you can use idletime for that. https://unix.stackexchange.com/questions/197469/delete-redis-keys-that-have-been-inactive-for-30-days
    We actually had this case for redis session db and set redis Eviction Policy with max memory to auto remove 'old' keys (allkeys-lru https://redis.io/topics/lru-cache)

  • UK5DS29L2
    UK5DS29L2 Posts: 546 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet

    that's not what TTL is for ๐Ÿ˜‰
    what I mean is I need to check whether the key has been refreshed correclty or I need to run a refresh process

  • UK5DS29L2
    UK5DS29L2 Posts: 546 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet

    storing the expiry date in another key sounds like a bad idea if there is a TTL in redis for checking the expiry

  • giovanni.piemontese
    giovanni.piemontese Technical Lead @ Lรถffelhardt Spryker Solution Partner Posts: 871 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet

    hi @UK5DS29L2 do u have to extend self on project level the redis client and the predisAdapter. We have made the same:
    RedisClient:

        /**
         * @param string $connectionKey
         * @param string $key
         * @param int $seconds
         *
         * @return bool
         */
        public function expire(string $connectionKey, string $key, int $seconds): bool;
    

    and predisApdapter

        /**
         * @param string $key
         * @param int $seconds
         *
         * @return bool
         */
        public function expire(string $key, int $seconds): bool;
    
  • UK5DS29L2
    UK5DS29L2 Posts: 546 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet
    edited January 2020

    @UL65CH0MC you're talking about EXPIRE command which sets the expire value. I'm looking to lookup the current expire value but I'll just add my own implementation as you have suggested

  • UK5DS29L2
    UK5DS29L2 Posts: 546 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet

    now I realize you just added this as an example ๐Ÿคฆโ€โ™‚๏ธ

  • giovanni.piemontese
    giovanni.piemontese Technical Lead @ Lรถffelhardt Spryker Solution Partner Posts: 871 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet

    yes... just as an example what do have to extend to get this.. ๐Ÿ˜‰ n.p.