CodeIgniter Forums
CachedObjects v1.2 - cache granularity as you want - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forum-22.html)
+--- Thread: CachedObjects v1.2 - cache granularity as you want (/thread-8845.html)

Pages: 1 2


CachedObjects v1.2 - cache granularity as you want - El Forum - 06-02-2008

[eluser]sdbruder[/eluser]
CachedObjects v1.2
cache granularity as you want

CachedObjects is a core extension (MY_Controller and MY_Model extensions) that implements caching at method level at call time.

Apart from extending the MY_ versions, all that you need to do is:
* Declare the time to cache calling methodcache(time_in_minutes);
* call ->mymethodCached(parameters) to cache ->mymethod(parameters);
* WARNING: CachedObjects will use object name, method name and parameter values to hash the cache name. If your method can accept a multitude of diferent values as parameters, you will get a multitude of cache entries. USE IT WISELY!

TODO
* The cache code is replicated in MY_Controller and MY_Model extensions, the bulk of it can be
extracted to a single place to avoid code replication.

In the package, there is a model / view / controller as an example, Open it in your applicaction directory and call http://yourserver/index.php/examplepage/. If you use it in your project, please send an email.

Download: http://sergio.bruder.com.br/cachedobjects/


CachedObjects v1.2 - cache granularity as you want - El Forum - 06-04-2008

[eluser]Maxximus[/eluser]
Hi, sounds interesting! I downloaded it, but wasn't able to open the archive (tried it as well as bz2, even as a zip). Could you have a look?


CachedObjects v1.2 - cache granularity as you want - El Forum - 06-04-2008

[eluser]sdbruder[/eluser]
In any *nix or mac os you can open it with tar -xvzf cachedobjects-1.2.tar.gz, Ive just verified it. In Windows you can use 7zip, freeware, opens it.
I'll submit a zip later.


CachedObjects v1.2 - cache granularity as you want - El Forum - 06-04-2008

[eluser]Maxximus[/eluser]
hmm well:
Code:
tar -xvzf cachedobjects-1.2.tar.gz
tar: This does not look like a tar archive
tar: Skipping to next header
tar: Error exit delayed from previous errors
Running Ubuntu Hardy. Will wait for your zip.


CachedObjects v1.2 - cache granularity as you want - El Forum - 06-04-2008

[eluser]sdbruder[/eluser]
Ive just downloaded it:

Code:
stratus:Downloads sergio$ file cachedobjects-1.2.tar
cachedobjects-1.2.tar: gzip compressed data, from Unix, last modified: Mon Jun  2 23:03:50 2008
stratus:Downloads sergio$ mv cachedobjects-1.2.tar  cachedobjects-1.2.tar.gz
stratus:Downloads sergio$ cd ~/temp
stratus:temp sergio$ tar -xvzf ~/Downloads/cachedobjects-1.2.tar.gz
libraries/MY_Controller.php
libraries/MY_Model.php
controllers/._examplepage.php
controllers/examplepage.php
models/examplemodel.php
views/._exampleview.php
views/exampleview.php
stratus:temp sergio$

Ive just uploaded a .ZIP version of it: http://sergio.bruder.com.br/cachedobjects/cachedobjects-1.2.zip


CachedObjects v1.2 - cache granularity as you want - El Forum - 06-05-2008

[eluser]Maxximus[/eluser]
Ok, ZIP works just fine. Looks nice! Will explore it further.


CachedObjects v1.2 - cache granularity as you want - El Forum - 06-17-2008

[eluser]jstrebel[/eluser]
Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of [runtime function name](). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in /site/application/libraries/MY_Model.php on line 110

Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of call_user_method_array(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in /site/application/libraries/MY_Model.php on line 111

Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of call_user_method_array(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in /site/application/libraries/MY_Model.php on line 115

Parse error: syntax error, unexpected T_NEW in /site/application/libraries/MY_Model.php on line 119


CachedObjects v1.2 - cache granularity as you want - El Forum - 06-18-2008

[eluser]sdbruder[/eluser]
what version of PHP? php 5.2.5 here.


CachedObjects v1.2 - cache granularity as you want - El Forum - 06-19-2008

[eluser]mglinski[/eluser]
Feature request that will make this very popular with big projects, implement MemCached as a cache storage object. If you want help with this let me know, as I am working on it now. Big Grin
-Matt


CachedObjects v1.2 - cache granularity as you want - El Forum - 06-21-2008

[eluser]sdbruder[/eluser]
Ive just included configurable backends for CachedObjects, implemented the original CodeIgniter system cache FS-based and a memcache backend.

Already tested the 2 backends, I only need to finish the documentation and get some sleep, I'll upload version 1.3 with ci-fs and memcache backends.