Part of the EllisLab Network
   
 
CachedObjects
Posted: 21 June 2008 08:01 PM   [ Ignore ]  
Summer Student
Avatar
Total Posts:  27
Joined  09-30-2007

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

NEW in v1.3
————-

- modularized backends for cache.
- new backend, memcache.
- now under version control
- now with makefile to create the packages, documentation, Changelog, site and upload it, all automagically. :p

grab it while it’s still hot! smile

Profile
 
 
Posted: 22 June 2008 07:00 AM   [ Ignore ]   [ # 1 ]  
Lab Assistant
RankRank
Total Posts:  146
Joined  01-02-2008

URL in last post doesn’t work, you copied an editpost url raspberry
I also left some notes in the previous topic.
-Matt

Profile
 
 
Posted: 22 June 2008 01:28 PM   [ Ignore ]   [ # 2 ]  
Summer Student
Avatar
Total Posts:  27
Joined  09-30-2007

Seems to be missing the 2 helper files codeigniter_helper and memcache_helper
I would also suggest that you namespace these files like:
co_codeigniter_helper.php and co_memcache_helper.php to avoid collisions, I know I already have a memcache helper. 
Also, if its not to much to ask, could you convert the docs to the CI type(here) it would help a lot of us that dont have linux or cygwin.
-Matt

OOps.

I’ll release 1.3.1 with the missing files and later a 1.4 with converted documentation to the ci format.

Talking about collisions, there is a way to use multiple Controller extenders? Basically if you use any library that extends Controller or Model, you are on your own, it will not work, Cachedobjects or any other controller-extender will break.

Profile
 
 
Posted: 22 June 2008 02:28 PM   [ Ignore ]   [ # 3 ]  
Summer Student
Avatar
Total Posts:  27
Joined  09-30-2007

v 1.3.1 released

Ive included the 4 (!!) missing files in the package and ‘namespaced’  some of them as XtraFile suggested. I’ll try to automate the file list in the makefile to prevent that type of errors in the future.

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

Profile
 
 
Posted: 25 July 2008 08:08 AM   [ Ignore ]   [ # 4 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  161
Joined  07-23-2006

I like the way this cache library works, it doesn’t get in the way at all. The only thing kind of missing is that I would like to overwrite how long certain methods can be cached, now I can set everything in the model to be cached for 60 minutes but what if I have one method that I would like cached for 60000 minutes?

good work!

 Signature 

running man webdevelopment

Profile
 
 
Posted: 25 July 2008 12:43 PM   [ Ignore ]   [ # 5 ]  
Summer Student
Avatar
Total Posts:  27
Joined  09-30-2007

the cache time is per object, you can use diferent cache times per object and actually you cant override per method.

I’ll think of something.

Note that if you use the memcache backend, YOU CAN override per method in that klunky way:

$yourcachedobject->methodcache(30000);
$cachedvalue $yourcachedobject->mymethodCached(parameters);
$yourcachedobject->methodcache(60); 

Its REAL, REAL ugly, its against all the “doesnt get it the way” principle of the library, and you need to do it in every call of your method, but it works.

Profile
 
 
Posted: 19 December 2008 09:33 AM   [ Ignore ]   [ # 6 ]  
Summer Student
Avatar
Total Posts:  4
Joined  12-26-2007

I found a bug (or feature): when the arguments to function is not a scalar variables — then the MD5 hash is the same for all calls. In my case I pass the arrays as arguments so I made small modification in your library:

original code

function mkid($id{
        
// Build the id.  The name is an MD5 hash of the $id array
        
$idstr '';
        foreach(
$id as $e{
            $idstr 
.= $e '::';
        
}
        
return md5($idstr);
    

modified code

function mkid($id{
        
// Build the id.  The name is an MD5 hash of the $id array
        
$idstr '';
        foreach(
$id as $e{
            $idstr 
.= (is_array($e) ? $this->mkid$e ) : $e) . '::';
        
}
        
return md5($idstr);
    

I just check the type of variable and run into recursion if it is not scalar.

Profile
 
 
Posted: 22 December 2008 03:59 PM   [ Ignore ]   [ # 7 ]  
Summer Student
Avatar
Total Posts:  27
Joined  09-30-2007
10fingers - 19 December 2008 02:33 PM

I found a bug (or feature): when the arguments to function is not a scalar variables — then the MD5 hash is the same for all calls. In my case I pass the arrays as arguments so I made small modification in your library:

You are right, this is a bug, I’ll include your fix in the next release (only in january. RL is getting priority).

Profile
 
 
Posted: 27 September 2009 01:34 PM   [ Ignore ]   [ # 8 ]  
Grad Student
Rank
Total Posts:  68
Joined  05-06-2008
10fingers - 19 December 2008 02:33 PM

I found a bug (or feature): when the arguments to function is not a scalar variables — then the MD5 hash is the same for all calls. In my case I pass the arrays as arguments so I made small modification in your library:

original code

function mkid($id{
        
// Build the id.  The name is an MD5 hash of the $id array
        
$idstr '';
        foreach(
$id as $e{
            $idstr 
.= $e '::';
        
}
        
return md5($idstr);
    

modified code

function mkid($id{
        
// Build the id.  The name is an MD5 hash of the $id array
        
$idstr '';
        foreach(
$id as $e{
            $idstr 
.= (is_array($e) ? $this->mkid$e ) : $e) . '::';
        
}
        
return md5($idstr);
    

I just check the type of variable and run into recursion if it is not scalar.

 

I use CO1.3,and when I runing example, an error occured:
A PHP Error was encountered

Severity: Notice

Message: Constant MEMCACHE_COMPRESSED already defined

Filename: helpers/co_memcached_helper.php

Line Number: 92


has it something wrong?
change 92 line:
define(“MEMCACHE_COMPRESSED”, 1<<1);

to:
//define(“MEMCACHE_COMPRESSED”, 1<<1);

it’s OK.


when I restart memcached service,and another error:

A PHP Error was encountered

Severity: Notice

Message: fwrite() [function.fwrite]: send of 38 bytes failed with errno=10054 An existing connection was forcibly closed by the remote host.

Filename: helpers/co_memcached_helper.php

Line Number: 395

 Signature 

linux | freebsd | PHP

Profile
 
 
Posted: 28 September 2009 09:30 PM   [ Ignore ]   [ # 9 ]  
Summer Student
Avatar
Total Posts:  16
Joined  08-20-2009

Any profiling test results maybe?

Profile
 
 
Posted: 10 October 2009 01:17 PM   [ Ignore ]   [ # 10 ]  
Grad Student
Rank
Total Posts:  68
Joined  05-06-2008

but I commit the line:

$this->output->enable_profiler(TRUE); 

to:

//$this->output->enable_profiler(TRUE); 

the output is also like this:
A PHP Error was encountered

Severity: Notice

Message: Constant MEMCACHE_COMPRESSED already defined

Filename: helpers/co_memcached_helper.php

Line Number: 92

 Signature 

linux | freebsd | PHP

Profile