swithek

Results 17 comments of swithek

And I think it shouldn't extend the expiration time of the active loop item when it's being loaded and passed into the func (i.e., it should work like the `Items()`...

It should work like sync.Map's [Range](https://pkg.go.dev/sync#Map.Range) and it should be possible to call `Set()`, etc. methods from within the provided func without any deadlocks.

It is worth noting that v3 has a similar (if not the same) feature: it calls all registered [callbacks](https://github.com/ReneKroon/ttlcache/blob/v3-dev/cache.go#L299) when `DeleteAll()` (the successor of `Purge()` ) is called.

In v3, `cache.Len()` can be combined with `cache.OnEviction()` to achieve what you need: ```go var ( mu sync.Mutex needsCleanup bool ) cache.OnEviction(func(ctx context.Context, r EvictionReason, item *Item[K, V]) { if...

@patpicos Thanks for the PR and sorry for the delay. I can see how this addition is useful, however, it might raise a few issues as well: - The `Set()`...

Yes, the transaction idea needs to be polished or at least limited in scope. As for your proposed changes and their use cases, I think what you have in mind...

I'm still not entirely convinced that the `Set()` method should contain this extra logic, especially if the method's purpose is changed. Another possible problem: most of the `Get()` options can...

@goccy what do you think about this?

@upamune I've merged your changes to the fork of this repository: https://github.com/jellydator/validation. The plan is to actively maintain it, so if you have any other changes, you can submit a...

We have an actively maintained [fork](https://github.com/jellydator/validation) as well. It has a few additions and fixes, most of which are from the PRs found in this repository.