cachedb_local: raise event on cache entry expiry#3853
Open
dondetir wants to merge 1 commit intoOpenSIPS:masterfrom
Open
cachedb_local: raise event on cache entry expiry#3853dondetir wants to merge 1 commit intoOpenSIPS:masterfrom
dondetir wants to merge 1 commit intoOpenSIPS:masterfrom
Conversation
Add E_CACHEDB_LOCAL_EXPIRED event support, allowing users to be
notified via event_route when cached entries expire. The event is
raised during the periodic cleanup timer (cache_clean_period) with
the following parameters:
- key: the expired cache key
- value: the expired cache value
- collection: the cache collection name
Example usage in the OpenSIPS script:
event_route[E_CACHEDB_LOCAL_EXPIRED] {
xlog("expired: $param(key) = $param(value)\n");
}
The event is raised outside the per-bucket hash table lock to avoid
deadlocks when the event_route handler accesses the cache. Expired
entry data is copied to pkg memory before lock release and freed
after the event is dispatched.
Uses the standard EVI (Event Interface) framework following the same
pattern as usrloc and dialog modules. An evi_probe_event() check
avoids parameter setup overhead when no subscribers exist.
Closes OpenSIPS#3735
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.
Summary
Add
E_CACHEDB_LOCAL_EXPIREDevent support, allowing users to be notified viaevent_routewhen cached entries expire.Usage
Event Parameters
keyvaluecollectionImplementation Details
cache_clean_period), not during lazy expiry on accessevent_routehandler accesses the cache — expired entry data is copied to pkg memory before lock releaseE_UL_CONTACT_DELETE) and dialog (E_DLG_STATE_CHANGED)evi_probe_event()check avoids parameter setup overhead when no subscribers existTesting
event_route— no deadlockCloses #3735