CACHEDB_SQL module
Admin Guide
Section titled “Admin Guide”Overview
Section titled “Overview”This module is an implementation of a cache system designed to work with a regular SQL-based server. It uses the internal DB interface to connect to the back-end, and also implements the Key-Value interface exported from the core.
Advantages
Section titled “Advantages”- memory costs are no longer on the server
- the cache is 100% persistent. A restart of OpenSIPS server will not affect the DB. The DB is also persistent so it can also be restarted without loss of information.
- Multiple OpenSIPS instances can easily share key-value information via a regular SQL-based database
Limitations
Section titled “Limitations”- The module’s counter operations (ADD and SUB) are currently only supported by MySQL
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)”The url of the Database that OpenSIPS will connect to in order to use the from script cache_store,cache_fetch, etc operations.
The format to follow is : sql:[conn_id]-dburl
The parameter can be set multiple times to create multiple connections accessible from the OpenSIPS script.
...modparam("cachedb_sql", "cachedb_url", "sql:1st-mysql://root:vlad@localhost/opensips_sql")......modparam("cachedb_sql", "cachedb_url", "sql:1st-mysql://root:vlad@localhost/opensips_sql")modparam("cachedb_sql", "cachedb_url", "sql:2nd-postgres://root:vlad@localhost/opensips_pg")......cache_store("sql:1st-mysql","key","$ru value");cache_store("sql:2nd-postgres","counter","10");...db_table (string)
Section titled “db_table (string)”The table of the Database that OpenSIPS will connect to in order to use the from script cache_store,cache_fetch, etc operations.
...modparam("cachedb_sql", "db_table","my_table");...key_column (string)
Section titled “key_column (string)”The column where the key will be stored
...modparam("cachedb_sql", "key_column","some_name");...value_column (string)
Section titled “value_column (string)”The column where the value will be stored
...modparam("cachedb_sql", "value_column","some_name");...counter_column (string)
Section titled “counter_column (string)”The column where the counter value will be stored
...modparam("cachedb_sql", "counter_column","some_name");...expires_column (string)
Section titled “expires_column (string)”The column where the expires will be stored
...modparam("cachedb_sql", "expires_column","some_name");...cache_clean_period (int)
Section titled “cache_clean_period (int)”The interval in seconds at which the expired keys will be removed from the database. Default value is 60 ( seconds )
...modparam("cachedb_sql", "cache_clean_period",10);...Exported Functions
Section titled “Exported Functions”The module does not export functions to be used in configuration script.
Frequently Asked Questions
Section titled “Frequently Asked Questions”Q: What happened with the old “db_url” module parameter?
It was replaced with the “cachedb_url” parameter. See the documentation for the usage of the “cachedb_url” parameter.
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) | 16 | 5 | 1006 | 92 |
| 2. | Liviu Chircu (@liviuchircu) | 11 | 9 | 43 | 60 |
| 3. | Razvan Crainea (@razvancrainea) | 8 | 6 | 7 | 5 |
| 4. | Stefan Darius | 7 | 4 | 218 | 22 |
| 5. | Bogdan-Andrei Iancu (@bogdan-iancu) | 5 | 3 | 5 | 2 |
| 6. | Alexandra Titoc | 4 | 2 | 4 | 3 |
| 7. | Maksym Sobolyev (@sobomax) | 4 | 2 | 1 | 2 |
| 8. | Julián Moreno Patiño | 3 | 1 | 2 | 2 |
| 9. | Dusan Klinec (@ph4r05) | 3 | 1 | 2 | 2 |
| 10. | Ovidiu Sas (@ovidiusas) | 3 | 1 | 1 | 1 |
All remaining contributors: Peter Lemenkov (@lemenkov), Vlad Patrascu (@rvlad-patrascu).
(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 | Jun 2026 - Jul 2026 |
| 2. | Razvan Crainea (@razvancrainea) | Aug 2015 - Jun 2026 |
| 3. | Alexandra Titoc | Sep 2024 - Sep 2024 |
| 4. | Maksym Sobolyev (@sobomax) | Feb 2023 - Feb 2023 |
| 5. | Ovidiu Sas (@ovidiusas) | Apr 2022 - Apr 2022 |
| 6. | Liviu Chircu (@liviuchircu) | Mar 2014 - Apr 2021 |
| 7. | Bogdan-Andrei Iancu (@bogdan-iancu) | Oct 2014 - Apr 2019 |
| 8. | Peter Lemenkov (@lemenkov) | Jun 2018 - Jun 2018 |
| 9. | Vlad Patrascu (@rvlad-patrascu) | May 2017 - May 2017 |
| 10. | Julián Moreno Patiño | Feb 2016 - Feb 2016 |
All remaining contributors: Dusan Klinec (@ph4r05), Vlad Paiu (@vladpaiu).
(1) including any documentation-related commits, excluding merge commits
Documentation
Section titled “Documentation”Contributors
Section titled “Contributors”Last edited by: Razvan Crainea (@razvancrainea), Peter Lemenkov (@lemenkov), Liviu Chircu (@liviuchircu), Julián Moreno Patiño, Vlad Paiu (@vladpaiu).
License
Section titled “License”All documentation files (i.e. .md extension) are licensed under the Creative Common License 4.0