Welcome Guest, Not a member yet? Register   Sign In
mp_cache
#1

[eluser]JanDoToDo[/eluser]
hey guys

I just tried using mp_cache and seem to be having a problem with it. It seems to write the cache file (as the log shows) but it never reads it. Here is my code
Code:
$this -> load -> library('MP_Cache');
        $cache_id = "ajax_tree/tree_view_" . "test";
        $cache_file = $this -> mp_cache -> get("$cache_id");

        if ($cache_file === FALSE) :
            echo "not using cache";
            $cache_file = $this -> load -> view($this -> config -> item('template_dir').'/ajax_tree', $x, TRUE);
            $this -> mp_cache -> write($cache_file, "$cache_id", 0);
            
        endif;

And the echo is always displayed on every page
#2

[eluser]Jelmer[/eluser]
[ Deleted the post to prevent misinforming anyone, I was mistaken here about my own code ]
#3

[eluser]JanDoToDo[/eluser]
Jelmer, I removed the 0 and it still didnt work. I also changed it to null and again it didnt work. Sad
#4

[eluser]JanDoToDo[/eluser]
and in the log:
MP_Cache file written: /var/www/html/public_html/devel/application/mp_cache/ajax_tree/tree_view_test.cache
#5

[eluser]Jelmer[/eluser]
I just read through the code again and noticed the library doesn't actually test if the fwrite() function was succesfull, only checks whether the file could be locked for usage and then asumes that means writing the contents should succeed as well.

Could you post the contents of the cache file?
#6

[eluser]JanDoToDo[/eluser]
I can't paste the whole cache file as it contains a large amount of HTML, but i guess the important part is: All of the HTML is preceded by this:

a:4:{s:19:"__mp_cache_contents";s:109403:" (and then my HTML starts, i.e.Smile

a:4:{s:19:"__mp_cache_contents";s:109403:"<a
#7

[eluser]JanDoToDo[/eluser]
Stupid codeigniter submit button..

I can’t paste the whole cache file as it contains a large amount of HTML, but i guess the important part is: All of the HTML is preceded by this:

a:4:{s:19:“__mp_cache_contents”;s:109403:” (and then my HTML starts, i.e.

a:4:{s:19:“__mp_cache_contents”;s:109403:”<a
#8

[eluser]Jelmer[/eluser]
It's actually more the part after the HTML I'm interested in, that's where the other options are set (expiration and dependencies).
#9

[eluser]JanDoToDo[/eluser]
Sorry.. this is annoying ive just psoted it twice but its being deleted ?!?!

Ill try again
This is after the end of the HTML

";s:18:"__mp_cache_created";i:1265293769;s:23:"__mp_cache_dependencies";a:0:{}s:18:"__mp_cache_expires";i:1265293769;}
#10

[eluser]Jelmer[/eluser]
That was what I was afraid of, it's set to expire today at 14:29 GMT (10 minutes ago) - which is probably its creation time. So for the expiration is still being set.

Looked through the code again and it appears I was mistaken and the original explanation in my User Guide was correct, setting it to 0 should prevent it from expiring while NULL sets it to the default (which is no expiration when not set). So that wasn't the problem, do you have default expiration set? And if so, to what? (that also shouldn't be a problem but just to fully understand the problem)

Also do you have error_reporting set to E_ALL? That might provide some insight into the problem if something else goes wrong.

Other than that I'm still drawing a blank as to why the expiration is set to now.




Theme © iAndrew 2016 - Forum software by © MyBB