PHP Classes

Adding this feature to other existing PDO classes

Recommend this page to a friend!

      PHP PDO Cache Query  >  All threads  >  Adding this feature to other...  >  (Un) Subscribe thread alerts  
Subject:Adding this feature to other...
Summary:I want to add this feature to other existing PDO classes
Messages:5
Author:behnamy
Date:2018-06-04 23:29:11
 

  1. Adding this feature to other...   Reply   Report abuse  
Picture of behnamy behnamy - 2018-06-04 23:29:11
Hi, thanks for your project, it's nice and useful, I'm currently using this class for PDO:
phpclasses.org/package/6809-PHP-Acc ...

How Can I add your package feature and its functionality to this class for preventing any change in my codes?

  2. Re: Adding this feature to other...   Reply   Report abuse  
Picture of Marco Cesarato Marco Cesarato - 2018-06-05 06:34:42 - In reply to message 1 from behnamy
Hi behnamy, just replace this string "new PDO" in pdo_database.class.php with "new CPDO".

  3. Re: Adding this feature to other...   Reply   Report abuse  
Picture of behnamy behnamy - 2018-06-05 08:54:24 - In reply to message 2 from Marco Cesarato
Thanks again, useful advise.
One more question, I checked your class codes and saw that every cached data is saving in $__cache variable!
So as it is a variable, not being saved in DB or file, the cache terminates and removes at the end of the script every time that script runs and finishes its work! So there wouldn't be any cache for the next time that script runs again.
Isn't better to save the $__cache data in a temporary DB table with memory engine, or in a File?
in this way the cache would last longer!

  4. Re: Adding this feature to other...   Reply   Report abuse  
Picture of Marco Cesarato Marco Cesarato - 2018-06-05 10:58:44 - In reply to message 3 from behnamy
Hi behnamy,
It depend what you need.
The objective of this class is have query faster and spend less resources.
If you retrieve data from file is slower than retrieve from database.
Another cons is if something is changed on database for example through phpmyadmin some data can be lost if you don't clear the cache.
Maybe i will implement a persistent cache but only if enabled by a flag because not all what a persistent cache of queries.
Thanks for your interest if you have others questions i'm available to respond you.

  5. Re: Adding this feature to other...   Reply   Report abuse  
Picture of behnamy behnamy - 2018-06-05 23:08:53 - In reply to message 4 from Marco Cesarato
Is the cached data valid when the record of the DB is UPDATED/DELETED from another script with simultaneous runnig?

 
For more information send a message to info at phpclasses dot org.