Ancestors

Toot

Written by Chris Abbey on 2024-10-28 at 17:14

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

Descendants

Written by Matthew Turland on 2024-10-28 at 17:18

@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

Written by Chris Abbey on 2024-10-28 at 17:22

@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

Written by Matthew Turland on 2024-10-28 at 17:24

@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

Written by Chris Abbey on 2024-10-28 at 17:26

@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

Written by Matthew Turland on 2024-10-28 at 17:32

@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

Written by Chris Abbey on 2024-10-28 at 17:38

@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

Written by Larry Garfield on 2024-10-28 at 20:27

@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

Proxy Information
Original URL
gemini://mastogem.picasoft.net/thread/113386171288641672
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
388.402659 milliseconds
Gemini-to-HTML Time
1.815285 milliseconds

This content has been proxied by September (3851b).