Exemple #1
0
 /**
  * 创建实例,Redis优先
  */
 public static function newInstance($name, $value = 0, $maxium = 0)
 {
     $obj = new RedisCounter($name, $value, $maxium);
     if (!$obj->connect()) {
         $obj = new FileCounter($name, $value, $maxium);
         $obj->connect();
     }
     $obj->readValue();
     return $obj;
 }
Exemple #2
0
 static function newInstance($A, $D = 0, $rC = 0)
 {
     $OB = new RedisCounter($A, $D, $rC);
     if (!$OB->connect()) {
         $OB = new FileCounter($A, $D, $rC);
         $OB->connect();
     }
     $OB->readValue();
     return $OB;
 }