Skip to content

CACHEDB_SQL module

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.

  • 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
  • The module’s counter operations (ADD and SUB) are currently only supported by MySQL

None.

The following libraries or applications must be installed before running OpenSIPS with this module loaded:

  • none:

The url of the Database that OpenSIPS will connect to in order to use the from script cache_store,cache_fetch, etc operations.

Set db_url parameter
...
modparam("cachedb_sql", "db_url","mysql://localhost/my_database");
...
Usage example
...
cache_store("sql","key","$ru value");
cache_add("sql","counter",10);
...

The table of the Database that OpenSIPS will connect to in order to use the from script cache_store,cache_fetch, etc operations.

Set db_url parameter
...
modparam("cachedb_sql", "db_table","my_table");
...

The column where the key will be stored

Set key_column parameter
...
modparam("cachedb_sql", "key_column","some_name");
...

The column where the value will be stored

Set value_column parameter
...
modparam("cachedb_sql", "value_column","some_name");
...

The column where the counter value will be stored

Set counter_column parameter
...
modparam("cachedb_sql", "counter_column","some_name");
...

The column where the expires will be stored

Set expires_column parameter
...
modparam("cachedb_sql", "expires_column","some_name");
...

The interval in seconds at which the expired keys will be removed from the database. Default value is 60 ( seconds )

Set cache_clean_period parameter
...
modparam("cachedb_sql", "cache_clean_period",10);
...

The module does not export functions to be used in configuration script.

Top contributors by DevScore(1), authored commits(2) and lines added/removed(3)

#NameDevScoreCommitsLines++Lines—
1.Vlad Paiu (@vladpaiu)1248323
2.Stefan Darius (@dariusstefan)7419721
3.Liviu Chircu (@liviuchircu)421514
4.Razvan Crainea (@razvancrainea)3111

(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

#NameCommit Activity
1.Stefan Darius (@dariusstefan)Jun 2026 - Jul 2026
2.Razvan Crainea (@razvancrainea)Jun 2026 - Jun 2026
3.Liviu Chircu (@liviuchircu)Oct 2014 - Oct 2014
4.Vlad Paiu (@vladpaiu)Jan 2013 - May 2014

(1) including any documentation-related commits, excluding merge commits

Last edited by: Razvan Crainea (@razvancrainea), Vlad Paiu (@vladpaiu).

All documentation files (i.e. .md extension) are licensed under the Creative Common License 4.0