Simple-PHP-Cache
Simple-PHP-Cache copied to clipboard
cache class not work in php loops
I Put cache class into foreach loops but cache class only add/set one data into cache file. code:
foreach($_POST['audio'] as $audio){ SQL::put("INSERT INTO " . NEWS_FILES . " (news_id, url, type) VALUES (?, ?, ?)", $id, $audio,"audio"); $c->store($id, array( 'action' => array( $id, $video,"audio") )); } cache File:
{"202":{"time":1410452801,"expire":0,"data":{"action":[202,"http://localhost/user/uploads/files/1/thumbs/1/audio/download-kid-photo-c.jpg","audio"]}}}
I have 4 files for id 202 But cache class insert only one files in file. how to fix this?
instead of caching data while writing, you should check if data is cached while reading. if cached, read from cache else make query and set cache.
I have a similar problem. Only the first value is stored. It happens in a AWS instance, but not in my XAMPP. I can clear the cache and write again, but only ONE value.
Any Idea?