[OpenSIPS-Users] variable/avp value check
Ben Newlin
Ben.Newlin at genesys.com
Mon Feb 12 15:42:45 UTC 2024
Alexey,
You have not provided the list of columns you want to the sql_cacher config. Please review https://opensips.org/docs/modules/3.2.x/sql_cacher.html#param_cache_table.
You need to add something like:
columns=column_1 column_2 column_3
Ben Newlin
From: Users <users-bounces at lists.opensips.org> on behalf of Alexey <slackway2me at gmail.com>
Date: Monday, February 12, 2024 at 1:23 AM
To: users at lists.opensips.org <users at lists.opensips.org>
Subject: Re: [OpenSIPS-Users] variable/avp value check
EXTERNAL EMAIL - Please use caution with links and attachments
Hi list,
We implemented next config:
# cachedb module
loadmodule "cachedb_local.so"
modparam("cachedb_local", "cachedb_url", "local:///my_cache")
modparam("cachedb_local", "cache_collections", "my_cache")
# sql_cacher module
loadmodule "sql_cacher.so"
modparam("sql_cacher", "cache_table", "id=my_cache
db_url=mysql://opensips:opensipsrw@x.x.x.x/opensips
cachedb_url=local:///my_cache
table=test
key=base_id
on_demand=0
")
$avp(list) = $sql_cached_value(my_cache:base_id:key1);
xlog(" local_cash id = $(avp(list)[*])\n");
avp_print();
The DB is something like that:
+----+------------+-----------+---+
| id | base_id | comment |
+----+------------+-----------+---+
| 1 | 111 | id_111 |
| 2 | 222 | id_222 |
| 3 | 333 | id_333 |
| 4 | ... | id_... |
+----+------------+-----------+---+
It seems the $sql_cached_value can extract the only one row
which is mentioned in the ‘key’ value from the cached DB.
But our goal is to extract the whole column (array)
from the DB and store that array to $avp.
Is there any way to extract the whole column
(base_id in my sample) from the cached DB ?
Maybe you can provide right way to make request via
$avp(a) = $sql_cached_value(caching_name:column_name_1:key1); ?
We expect something similar to
avp_db_query("select base_id from test","$avp(list)");
xlog("avp(list)=$(avp(list)[*])\n");
Thanks in advance !
--
best regards, Alexey
https://alexeyka.zantsev.com
_______________________________________________
Users mailing list
Users at lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20240212/44e87d2c/attachment-0001.html>
More information about the Users
mailing list