Repository navigation
Update module github.com/maypok86/otter to v2 - #137
Open
renovate[bot] wants to merge 1 commit into
Open
renovate[bot] wants to merge 1 commit into
renovate[bot] wants to merge 1 commit into
Conversation
renovate
Bot
force-pushed
the
renovate/github.com-maypok86-otter-2.x
branch
7 times, most recently
from
September 10, 2026 19:45
1fec298 to
d4f794e
Compare
renovate
Bot
force-pushed
the
renovate/github.com-maypok86-otter-2.x
branch
8 times, most recently
from
September 19, 2026 18:42
b6bc922 to
7fc63ae
Compare
renovate
Bot
force-pushed
the
renovate/github.com-maypok86-otter-2.x
branch
7 times, most recently
from
September 26, 2026 12:50
c819086 to
d622c7d
Compare
renovate
Bot
force-pushed
the
renovate/github.com-maypok86-otter-2.x
branch
4 times, most recently
from
October 5, 2026 04:35
9a66578 to
73a5ee0
Compare
renovate
Bot
force-pushed
the
renovate/github.com-maypok86-otter-2.x
branch
from
October 23, 2026 03:42
73a5ee0 to
6384951
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
v1.2.4→v2.4.0Release Notes
maypok86/otter (github.com/maypok86/otter)
v2.4.0Compare Source
2.4.0 - 2026-10-20
📝 Description
This release is mostly about correctness. The fixes come from audits of races between loads, refreshes, writes and expiration, of how the cache handles panics and
runtime.Goexitin user code, and of its lifecycle. A new test checks random concurrent histories of the cache for linearizability with porcupine. Loading and refresh are now linearizable: a load or refresh that started before a write no longer replaces the value the write stored (comparison with other caches). Updates of live entries now happen in place, which makes them 2–19× faster depending on the value type and contention. Binaries are smaller too: a program with one cache is 3.15 MB instead of 4.41 MB, and each additional cache type adds about 160 KB instead of 350 KB.✨Features
CoarseClock, aClockthat reads the time once per resolution and can be shared by several caches. With expiration it makesGetIfPresent26–57% faster (#281)GetorBulkGetthat waits for another goroutine's load now follows its own context. It returnsctx.Err()when its context is done; the load keeps running and caches its value. If the load failed because the owner's context was done, a waiter with a live context loads the key again (#237)🚀 Improvements
ExpiryWritingandExpiryCreatingno longer callExpireAfterRead(up to 29% faster), and reads with access-based expiration don't write a deadline that moves by less than a second (37–48% faster from 4+ goroutines) (#225, #226)sync.Pool, loses fewer reads and no longer shares cache lines with other objects. A mix of 75% reads on 8 threads is 55% faster (#219, #236)maphashand unlinks empty overflow buckets, which saves ~34 MB per 1M entries and speeds up misses. Resizes and allocating a largeInitialCapacityare faster too (#211, #212, #213, #214, #224)Executormust not do and whatStopAllGoroutinesstops. Places where it disagreed with the code are fixed (#258, #262, #266, #294, #295)Executormust not block the submitter. A bounded pool should run the task on the caller when it is full (#263)OnDeletion,OnAtomicDeletion, the stats recorder and the logger are logged and dropped. Panics inCompute, the weigher and the calculators still reach the caller, but the entry is left unchanged (#191)SetExpiresAfterandSetRefreshableAftertake the key's bucket lock, so calling them fromCompute*,OnAtomicDeletion, a weigher or a calculator deadlocks (#247)Setreturns(value, true),Invalidatereports nothing invalidated, and a write over it is a creation (ExpireAfterCreate,RefreshAfterCreate) (#208, #230)GetandBulkGetwith a context that is already done returnctx.Err()without calling the loader. The loader may be called more than once for oneGetwhen the key is invalidated while it loads (#288, #295)BulkGetno longer returns keys that the bulk loader leaves out, and extra keys returned by the bulk loader only fill gaps instead of overwriting values (#202, #206)CauseExpirationand counted inEvictions; evictions are recorded beforeOnDeletionruns (#235, #253)OnAtomicDeletionruns before the node is retired and may be called again for the same removal if it exits withruntime.Goexit(#286)All,Keys,Values,Hottest,Coldest) is weakly consistent rather than a snapshot (#245)runtime.AddCleanup: the periodic clean-up goroutine holds a weak pointer and exits after the cache is collected (#279)Newpanics whenInitialCapacityis too large to allocate (#252)🐞 Bug Fixes
Loading and refresh:
GetandBulkGetcould call the loader more than once for one key (#152, #184, #241)SetorComputewrote while it ran; with the default executor 970 of 1,000Sets after a staleGetwere lost (#203, #240, #243)Invalidatecould bring the key back, and aGetthat joined a discarded or failed refresh got that refresh's result instead of the key's value (#243, #288)ComputereturningCancelOpover an expired entry cancelled the key's in-flight load (#210)BulkGetreported a key missing or lost the error of a load it joined when its own bulk loader also returned that key (#288)Refreshthat joined aGetwhose context was done reported that cancellation instead of loading the key (#292)Gets hung (#257)Expiration:
math.MaxInt64overflowed into a past deadline, so the entry expired at once and everyGetreloaded it (#204)SetExpiresAftercould revive an expired entry (#208, #249)SetExpiresAfterandSetRefreshableAfterwere undone by a concurrent write or a failed reload (#247)SetExpiresAftercould be ignored by the timer wheel until the old deadline (#209)RefreshCreatingreloaded a value written over an expired entry on its first read (#230)CleanUp,Entry.HasExpiredandLoadCacheFromtreated an entry as live at its exact deadline. A clock started before 1970 expired every entry at once, and one whose readings crossed zero left passed deadlines unexpired (#234, #268)Eviction and policy:
Hottest,ColdestorInvalidateAll(#288)SetMaximum, collapsed the window of a cache created with a smallInitialCapacity, and counted a refresh as an access (#260, #271)ComputeIfPresentrecorded a hit and calledExpireAfterReadbefore running its function (#271)InitialCapacityabove ~8e9 wrapped the table size to zero (#252)InvalidateAlland iteration (includingSaveCacheTo) skipped keys whose node was replaced meanwhile, andHottest/Coldestmerged the window and probation queues in the wrong order (#205, #207, #245)Listeners and stats:
OnDeletionandOnAtomicDeletioncould get different causes for one removal (#196)SetorComputeracing a read could report an entry as present and as expired at the same time (#290)CauseOverflow, an expired entry removed by a write wasn't counted as an eviction, and a load whose result panicked wasn't counted at all (#201, #235, #253)Persistence:
LoadCacheFromfilled the cache in the snapshot's units instead of its own, moved restored deadlines later, recorded phantom hits, and lost its warm-up withoutInitialCapacity(#259, #270, #274)SaveCacheToFilewasn't atomic (#268)Panics,
runtime.Goexitand lifecycle:runtime.Goexitin a callback, loader, clock, executor, logger or stats recorder could leave a bucket or the eviction lock held, waiters hanging, a write outside the policies or a refresh unreported (#191, #264, #265, #268, #286, #287, #295)testing/synctestbubble crashed the program (#279)StopAllGoroutinesdeadlocked when called fromHottest,Coldestor aSaveCacheTowriter; a closedTickchannel made the clean-up goroutine spin; the default clock leaked its ticker (#294)testingand testify were compiled into every program that imported otter (#185, #186)v2.3.0Compare Source
2.3.0 - 2025-12-22
✨Features
sloglogger has been added.StopAllGoroutinesmethod has been added.🚀 Improvements
🐞 Bug Fixes
Contributors
We'd like to thank all the contributors who worked on this release!
@maxtwardowski @dwisiswant0
v2.2.1Compare Source
2.2.1 - 2025-07-22
🚀 Improvements
ErrNotFound(#136)🐞 Bug Fixes
InvalidateAllandGetunder high contention (#139)v2.2.0Compare Source
2.2.0 - 2025-07-07
This release focuses on improving the integration experience with pull-based metric collectors.
✨Features
IsWeighted,IsRecordingStatsandStatsmethods for cache (#131)MinusandPlusmethods forstats.Statsstats.Snapshoterandstats.SnapshotRecorderinterfaces🚀 Improvements
stats.Counterby 4 timesv2.1.1Compare Source
2.1.1 - 2025-07-05
🚀 Improvements
Getnow returns the value from the loader even when an error is returned. (#132)v2.1.0Compare Source
2.1.0 - 2025-06-29
✨Features
Compute,ComputeIfAbsentandComputeIfPresentmethodsLoadCacheFrom,LoadCacheFromFile,SaveCacheToandSaveCacheToFilefunctionsClockinterface and option for time mockingKeysandValuesiteratorsHottestandColdestiterators🚀 Improvements
🐞 Bug Fixes
context.WithoutCancelduring refresh execution (#124)v2.0.0Compare Source
2.0.0 - 2025-06-18
📝 Description
Otter v2 has been completely redesigned for better performance and usability.
Key improvements:
🚨 Breaking Changes
Cache Creation
Builderpattern in favor of canonicalOptionsstructMustBuilderandBuildermethods are replaced withMustandNewfunctionsCostrenamed toWeightcapacitywith explicitMaximumSizeandMaximumWeightparametersDeletionListenerwithOnDeletionandOnAtomicDeletionhandlersCache API Changes
Getmethod renamed toGetIfPresentSetmethod signature changed to return both value and boolSetIfAbsentmethod signature changed to return both value and boolDeletemethod renamed toInvalidateClearmethod renamed toInvalidateAllSizemethod renamed toEstimatedSizeCapacitymethod renamed toGetMaximumRangemethod removed in favor ofAlliteratorHasmethod removedDeleteByFuncmethod removedStatsmethod removed in favor ofstats.RecorderinterfaceClosemethod removedExpiration
ExpiryCalculatorinterfaceExpiryCreating,ExpiryWritingandExpiryAccessingfunctions introducedStatistics
statsstats.Recorderinterface andstats.Counterstruct introducedExtension
Extensionstruct removed in favor of methods fromCache✨Features
Loading
Getmethod for obtaining values if necessaryLoaderinterface for retrieving values from the data sourceErrNotFounderror for indicating missing entriesRefresh
RefreshCalculatorinterfaceRefreshCreating,RefreshWritingfunctions introducedRefreshmethod for refreshing values asynchronouslyBulk Operations
BulkGetfor loading multiple values at onceBulkRefreshfor refreshing multiple values asynchronouslyBulkLoaderinterface for retrieving multiple values from the data source at onceCache Methods
Allmethod for iterating over all entriesCleanUpmethod for performing pending maintenance operationsWeightedSizemethod for weight-based cachesEnhanced Configuration
Executoroption for customizing async operationsLoggerinterface for custom loggingEntry Management
SetExpiresAfterandSetRefreshableAfterfor per-entry time controlGetEntryandGetEntryQuietlymethods for accessing cache entriesEntry's methods replaced with public fields for direct access.Deletion Notifications
DeletionListenerwithOnDeletionandOnAtomicDeletionhandlersIsEvictionmethodDeletionEventstructPerformance Improvements
S3-FIFOwith adaptiveW-TinyLFU🚀 Improvements
stats.Recorderinterface (#119)time.Second(#115)Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.