Anyone have a PSR-6 or PSR-16 LRU implementation they like that is production ready? I see a few in my searches but they all seem to be toy/experimental. #php
edit to add clarification: looking for basic in php process / memory cache, not external caches like Memcached or redis or etc... already have those.
=> More informations about this toot | More toots from cabbey@phpc.social
@cabbey Haven't used it a LOT, but have you tried symfony/cache? https://packagist.org/packages/symfony/cache
=> More informations about this toot | More toots from elazar@phpc.social
@elazar we aren't a Symfony shop, so I haven't tried it, no... but I did look at it last week when I started thinking I wanted one... I didn't see any indication that it had an LRU capability. Did I miss something in the docs?
=> More informations about this toot | More toots from cabbey@phpc.social
@cabbey You don't need to be a Symfony shop to use Symfony packages these days; they're largely independent components that just happen to be particularly cohesive with Symfony. Re: LRU usage, I think that depends on the adapter/backend you're using, but it has adapters for several common ones. https://symfony.com/doc/current/components/cache.html#available-cache-adapters
=> More informations about this toot | More toots from elazar@phpc.social
@elazar true, and composer says we have a few symfony packages pulled in as deps already, so might be easy to try. Important item I just realiezd wasn't clear and edited into my original post: I'm looking for LRU on simple in memory cache, not off board caches.
=> More informations about this toot | More toots from cabbey@phpc.social
@cabbey The Array adapter for symfony/cache has an LRU setting in terms of number of entries.
https://symfony.com/doc/current/components/cache/adapters/array_cache_adapter.html
If you're wanting to do it in terms of memory usage, it might be possible to write a custom adapter for that.
=> More informations about this toot | More toots from elazar@phpc.social
@elazar ah, I suspect the first line of that page scared me off of it. I'll give that a whirl when I get back to this project, thanks!
=> More informations about this toot | More toots from cabbey@phpc.social
@cabbey The fig/cache-util library has an in memory implementation for testing. It's not LRU, but adding that is probably not too difficult?
=> More informations about this toot | More toots from Crell@phpc.social This content has been proxied by September (3851b).Proxy Information
text/gemini