CACHEDB_LOCAL module
Admin Guide
Section titled “Admin Guide”Overview
Section titled “Overview”This module is an implementation of a local cache system designed as a hash table. It uses the Key-Value interface exported by OpenSIPS core. Starting with version 2.3, the module can have multiple hash tables, called collections. Each url for cachedb_local module points to one collection. One collection can be shared between multiple urls.
Dependencies
Section titled “Dependencies”OpenSIPS Modules
Section titled “OpenSIPS Modules”None.
External Libraries or Applications
Section titled “External Libraries or Applications”The following libraries or applications must be installed before running OpenSIPS with this module loaded:
- none
Exported Parameters
Section titled “Exported Parameters”cachedb_url (string)
Section titled “cachedb_url (string)”URL parameter used to define cachedb_local collections. One collection can belong to multiple URLs, but one URL can have only one collection. Redefining an URL with the same schema and group name will result in overwriting that URL. Each collection used in URL definition must be defined using cachedb_collection parameter. The collection shall be defined as a normal database, at the end of the URL as in the examples. In the script the collection shall be identified using the schema and, if exists, the group name.
“If no URL defined, the url with no group name and collection “default” will be used.”.
...### for this example, if no collection is defined, the default collection named### "default" shall be usedmodparam("cachedb_local", "cachedb_url", "local://")### this URL will use the collection named collection1; it will overwrite the### previous url definition which was using the "default" collectionmodparam("cachedb_local", "cachedb_url", "local:///collection1")### this URL will use collection2; it will be referenced from the script### with "local:group2"modparam("cachedb_local", "cachedb_url", "local:group2:///collection2")
## how to use the URLs from the script## as defined above, this call will use collection1cache_store("local", ...)## as defined above, this call will use collection2cache_store("local:group2", ...)...cache_collections (string)
Section titled “cache_collections (string)”Using this parameter collections(hash tables) and their sizes can be defined. Each collection definition must be separated one from another using ’;’. Default size for a hash is 512. The size must be separated from the name of the collection using ’=’. Every collection that is defined in this parameter SHOULD be used in at least one URL, else you’ll receive a WARNING.
“If no collection is defined, the collection with name “default” will be created.”.
...## creating collection1 with default size (512) and collection2 with custom size## 2^5 (32); we also changed the size of the default collection, which would have been## created anyway from 2^9 - 512 (default value) to 2^4 - 16modparam("cachedb_local", "cache_collections", "collection1; collection2=5; default=4")...cache_clean_period (int)
Section titled “cache_clean_period (int)”The time interval in seconds at which to go through all the records and delete the expired ones.
Default value is “600 (10 minutes)”.
...modparam("cachedb_local", "cache_clean_period", 1200)...Exported Functions
Section titled “Exported Functions”cache_remove_chunk([collection,] glob)
Section titled “cache_remove_chunk([collection,] glob)”Remove all keys from local cache that match the glob pattern corresponding to a certain collection or the ‘default’ collection if none defined. Keep in mind that collection name is different than group name, which identifies the engine in cachedb operations.
This function can be used from all routes
... cache_remove_chunk("myinfo_*"); cache_remove_chunk("collection1", "myinfo_*"); ...Exported MI Functions
Section titled “Exported MI Functions”cache_remove_chunk
Section titled “cache_remove_chunk”Removes all local cache entries that match the provided glob param.
Parameters :
- collection(optional) - collection from which the keys shall be removed; if no collection set, the default collection will be used;
- glob - keys that match glob will be removed
MI FIFO Command Format:
:cache_remove_chunk:_reply_fifo_file_ collection* keyprefix* _empty_line_Frequently Asked Questions
Section titled “Frequently Asked Questions”Q: What happened with old cache_table_size parameter?
The parameter was removed because it was redundant. Since the addition of collections, the old hash now belongs to the default collection. This collection is created every time and it has a default size of 512. The size can be changed by setting the default collection size using cache_collections paramter.
doc copyrights:
Contributors
Section titled “Contributors”By Commit Statistics
Section titled “By Commit Statistics”Top contributors by DevScore(1), authored commits(2) and lines added/removed(3)
| # | Name | DevScore | Commits | Lines++ | Lines— |
|---|---|---|---|---|---|
| 1. | Vlad Paiu (@vladpaiu) | 32 | 10 | 1155 | 693 |
| 2. | Bogdan-Andrei Iancu (@bogdan-iancu) | 15 | 13 | 41 | 47 |
| 3. | Anca Vamanu | 14 | 5 | 750 | 65 |
| 4. | Andrei Dragus | 10 | 4 | 183 | 182 |
| 5. | Ionut Ionita (@ionutrazvanionita) | 10 | 3 | 550 | 92 |
| 6. | Stefan Darius (@dariusstefan) | 8 | 5 | 225 | 32 |
| 7. | Liviu Chircu (@liviuchircu) | 7 | 4 | 42 | 84 |
| 8. | Razvan Crainea (@razvancrainea) | 5 | 3 | 6 | 6 |
| 9. | Dusan Klinec (@ph4r05) | 3 | 1 | 4 | 4 |
| 10. | Ryan Bullock (@rrb3942) | 3 | 1 | 3 | 5 |
All remaining contributors: Vlad Patrascu (@rvlad-patrascu), Julián Moreno Patiño.
(1) DevScore = author_commits + author_lines_added / (project_lines_added / project_commits) + author_lines_deleted / (project_lines_deleted / project_commits)
(2) including any documentation-related commits, excluding merge commits
(3) ignoring whitespace edits, renamed files and auto-generated files
By Commit Activity
Section titled “By Commit Activity”| # | Name | Commit Activity |
|---|---|---|
| 1. | Stefan Darius (@dariusstefan) | Jun 2026 - Jul 2026 |
| 2. | Razvan Crainea (@razvancrainea) | Aug 2015 - Jun 2026 |
| 3. | Bogdan-Andrei Iancu (@bogdan-iancu) | Jan 2009 - Aug 2018 |
| 4. | Liviu Chircu (@liviuchircu) | Mar 2014 - Jun 2018 |
| 5. | Vlad Patrascu (@rvlad-patrascu) | Jan 2017 - Jan 2017 |
| 6. | Ionut Ionita (@ionutrazvanionita) | Jan 2017 - Jan 2017 |
| 7. | Julián Moreno Patiño | Feb 2016 - Feb 2016 |
| 8. | Dusan Klinec (@ph4r05) | Dec 2015 - Dec 2015 |
| 9. | Ryan Bullock (@rrb3942) | Jan 2014 - Jan 2014 |
| 10. | Vlad Paiu (@vladpaiu) | Oct 2011 - Nov 2013 |
All remaining contributors: Andrei Dragus, Anca Vamanu.
(1) including any documentation-related commits, excluding merge commits
Documentation
Section titled “Documentation”Contributors
Section titled “Contributors”Last edited by: Razvan Crainea (@razvancrainea), Bogdan-Andrei Iancu (@bogdan-iancu), Liviu Chircu (@liviuchircu), Ionut Ionita (@ionutrazvanionita), Vlad Paiu (@vladpaiu), Andrei Dragus, Anca Vamanu.
License
Section titled “License”All documentation files (i.e. .md extension) are licensed under the Creative Common License 4.0