mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-22 21:16:16 -06:00
[chore]: Bump codeberg.org/gruf/go-cache/v3 from 3.2.3 to 3.2.5 (#1701)
Bumps codeberg.org/gruf/go-cache/v3 from 3.2.3 to 3.2.5. --- updated-dependencies: - dependency-name: codeberg.org/gruf/go-cache/v3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
parent
c5f61c456b
commit
a3d2774db5
6 changed files with 44 additions and 22 deletions
7
vendor/codeberg.org/gruf/go-cache/v3/result/cache.go
generated
vendored
7
vendor/codeberg.org/gruf/go-cache/v3/result/cache.go
generated
vendored
|
|
@ -28,6 +28,7 @@ type Lookup struct {
|
|||
// cache would be in wrapping a database, allowing caching of sql.ErrNoRows.
|
||||
type Cache[Value any] struct {
|
||||
cache ttl.Cache[int64, result[Value]] // underlying result cache
|
||||
invalid func(Value) // store unwrapped invalidate callback.
|
||||
lookups structKeys // pre-determined struct lookups
|
||||
ignore func(error) bool // determines cacheable errors
|
||||
copy func(Value) Value // copies a Value type
|
||||
|
|
@ -114,7 +115,8 @@ func (c *Cache[Value]) SetInvalidateCallback(hook func(Value)) {
|
|||
if hook == nil {
|
||||
// Ensure non-nil hook.
|
||||
hook = func(Value) {}
|
||||
}
|
||||
} // store hook.
|
||||
c.invalid = hook
|
||||
c.cache.SetInvalidateCallback(func(item *ttl.Entry[int64, result[Value]]) {
|
||||
for _, key := range item.Value.Keys {
|
||||
// Delete key->pkey lookup
|
||||
|
|
@ -241,6 +243,9 @@ func (c *Cache[Value]) Store(value Value, store func() error) error {
|
|||
// Cache result
|
||||
c.store(result)
|
||||
|
||||
// Call invalidate.
|
||||
c.invalid(value)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue