This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

Caching Symfony Functions That take Arguments

Discussion relating to version 1.2.x stable

Caching Symfony Functions That take Arguments

by 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

Re: Caching Symfony Functions That take Arguments

by alina » Wed Oct 22, 2014 2:26 pm

When saving a blog post in Sympal, it seems an infinite loop is triggered whereby calls to Doctrine's Parser.php are made repeatedly and the Apache process eventually uses all the memory allotted by PHP. Here's a more detailed description I posted on the Doctrine user group.
Junior Member
Posts: 2
Joined: Wed Oct 22, 2014 2:24 pm