Caching Symfony Functions That take Arguments

Discussion relating to version 1.2.x stable

Caching Symfony Functions That take Arguments

Postby gentrobot » Fri Sep 14, 2012 1:05 pm

I am working on Symfony 1.2 with Propel. I have created a method that takes in a string value, matches it with the user records and returns the matching user's record.

My code:

Code: Select all
class UsersPeer extends BaseUsersPeer

  public static function getHashUser($hash)
    $c = new Criteria();
    return UsersPeer::doSelectOne($c);


Does it make sense to cache this function? My understanding says that since the string value passed to the function shall always be different for different users, the function shall execute each time. However, it shall not execute again for the the users, for whom the string value has previously been passed to the method and record retrieved. Only in such cases the function caching shall work. Given that there are approximately 50K users, does it make any sense enabling caching for this method ?
Posts: 45
Joined: Thu Oct 08, 2009 7:43 am

Return to symfony 1.2

Who is online

Users browsing this forum: No registered users and 1 guest