Ejemplo n.º 1
0
 public static function getPuserIdFromKuserId($partner_id, $kuser_id)
 {
     $cache = new myObjectCache();
     $key = $partner_id . "|" . $kuser_id;
     $puser_id = $cache->get("puser_kuser_id", $key);
     if ($puser_id == null) {
         $c = new Criteria();
         $c->add(self::PARTNER_ID, $partner_id);
         $c->add(self::KUSER_ID, $kuser_id);
         $puser_kusers = self::doSelect($c);
         if (count($puser_kusers) > 0) {
             $puser_kuser = $puser_kusers[0];
             $puser_id = $puser_kuser->getPuserId();
         } else {
             $puser_kuser = null;
             $puser_id = "null";
             // set the string null so this will be set in the cache
         }
         $cache->putValue("puser_kuser_id", $key, null, $puser_id);
     }
     if ($puser_id == "null") {
         return null;
     }
     // return the null object not the "null" string
     return $puser_id;
 }
Ejemplo n.º 2
0
 private static function putPartnerInCache($obj, $by_id = true, $pk = null)
 {
     // if there is no partner - cache for a short while assuming we are in the middle of creating one
     // if there is a partner - cache for a little longer assuming it doesn't change very much once it's created
     //$expiry = ( $obj != null ? 600 : 60 );
     if ($obj == null) {
         $cache = new myObjectCache(self::EXPIRY_FOR_NULL);
         if ($by_id) {
             $cache->putValue(self::CLZZ, $pk, null, self::NULL_PARTNER);
         } else {
             $cache->putValue(self::CLZZ, $pk, "partnerAlias", self::NULL_PARTNER);
         }
     } else {
         $cache = new myObjectCache(self::EXPIRY_FOR_NON_NULL);
         if ($by_id) {
             $cache->put($obj);
         } else {
             $cache->put($obj, "partnerAlias");
         }
     }
 }