MySQL Caches - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: MySQL Caches (
/showthread.php?tid=624332)
MySQL Caches -
GoldenLion - 14.12.2016
Hi, is it important to delete caches? The only thing that confuses me about MySQL right now are the caches. Are there any tutorials about that or can someone be so kind and tell me about caches? Like what are they even for? I heard they are stored in the memory or something. I looked at the MySQL's website, but that didn't really help me.
Re: MySQL Caches - iLearner - 14.12.2016
As far as i know, you should ad must delete them, as they can somehowbe used to hack your database (i amnot saying it onmy own).
The so called hijacking thing through inputs.
Re: MySQL Caches -
GoldenLion - 14.12.2016
Quote:
Originally Posted by iLearner
As far as i know, you should ad must delete them, as they can somehowbe used to hack your database (i amnot saying it onmy own).
The so called hijacking thing through inputs.
|
That's SQL injection. That happens when you don't escape strings.
Re: MySQL Caches - iLearner - 14.12.2016
Cache is something similar then.
Re: MySQL Caches -
Konstantinos - 14.12.2016
http://dev.mysql.com/doc/refman/5.7/en/query-cache.html
If you use non-threaded queries(
1) or save the cache for later use(
2), then yes - you need to remove the cache from the memory to avoid memory leaks.
(
1)SELECT or INSERT (with auto increment to retrieve) queries.
(
2)
cache_save() function saves the result in memory and we can set it as active cache later on and retrieve the data. Afterwards, it is not used anywhere else so
cache_remove() which also unsets the cache after deleting.
Re: MySQL Caches -
GoldenLion - 14.12.2016
But threaded queries don't save cache unless I save it, am I right?
Re: MySQL Caches -
Konstantinos - 14.12.2016
They do use cache but it is deleted automatically after the code of the specified callback is executed (finished). I supposed that for those queries that do not specify a callback, it is deleted right after the execution.
Re: MySQL Caches -
NeXoR - 14.12.2016
Quote:
Originally Posted by Konstantinos
http://dev.mysql.com/doc/refman/5.7/en/query-cache.html
If you use non-threaded queries( 1) or save the cache for later use( 2), then yes - you need to remove the cache from the memory to avoid memory leaks.
( 1)SELECT or INSERT (with auto increment to retrieve) queries.
( 2) cache_save() function saves the result in memory and we can set it as active cache later on and retrieve the data. Afterwards, it is not used anywhere else so cache_remove() which also unsets the cache after deleting.
|
Just a question about (1), how can I delete the cache saved after auto increment retrieval ?
Since in usual I need result id
Re: MySQL Caches -
Rdx - 15.12.2016
Quote:
Originally Posted by Konstantinos
If you use non-threaded queries
|
That's not true. I have never used threaded queries and there was no memory leaks on my servers.
Cache is always deleting by self, you only need to delete it when you use cache_save.
Re: MySQL Caches -
Konstantinos - 15.12.2016
Quote:
Originally Posted by Rdx
That's not true. I have never used threaded queries and there was no memory leaks on my servers.
Cache is always deleting by self, you only need to delete it when you use cache_save.
|
What makes you think the person who maintains the plugin would write false claims in the
wiki page for?