I have a table called User_im_prefs with this definition:
create table user_im_prefs (
    user_id integer not null comment 'user' references user (id),
    screenname varchar(255) not null comment 'screenname on this service',
    transport varchar(255) not null comment 'transport (ex xmpp, aim)',
    notify tinyint(1) not null default 0 comment 'Notify when a new notice
is sent',
    replies tinyint(1) not null default 0 comment 'Send replies  from
people not subscribed to',
    microid tinyint(1) not null default 1 comment 'Publish a MicroID',
    updatefrompresence tinyint(1) not null default 0 comment 'Send replies
 from people not subscribed to.',
    created timestamp not null DEFAULT CURRENT_TIMESTAMP comment 'date
this record was created',
    modified timestamp comment 'date this record was modified',

    primary key (user_id, transport),
    unique `transport_screenname_idx` ( `transport` , `screenname` )
);

I do two kinds of searches, with this code:

    function get_user_im_prefs_from_user($user)
    {
        $user_im_prefs = new User_im_prefs();
        $user_im_prefs->transport = $this->transport;
        $user_im_prefs->user_id = $user->id;
        if($user_im_prefs->find() && $user_im_prefs->fetch()){
            return $user_im_prefs;
        }else{
            return false;
        }
    }

    function get_user_im_prefs_from_screenname($screenname)
    {
        $user_im_prefs = new User_im_prefs();
        $user_im_prefs->transport = $this->transport;
        $user_im_prefs->screenname = $screenname;
        if($user_im_prefs->find() && $user_im_prefs->fetch()){
            return $user_im_prefs;
        }else{
            return false;
        }
    }

These searches using find() are not cached using memcached. How can I
adjust the code so the cache is used?

Thanks,
~Craig

_______________________________________________
StatusNet-dev mailing list
StatusNet-dev@lists.status.net
http://lists.status.net/mailman/listinfo/statusnet-dev

Reply via email to