CoRedisPool.php 510 B

123456789101112131415161718192021222324252627
  1. <?php
  2. class CoRedisPool extends CoPool
  3. {
  4. const max_clients = 100;
  5. private static $stInstance = null;
  6. public static function instance()
  7. {
  8. if (self::$stInstance == null) {
  9. self::$stInstance = new CoRedisPool();
  10. }
  11. return self::$stInstance;
  12. }
  13. private function __construct()
  14. {
  15. parent::__construct(self::max_clients);
  16. }
  17. public function create_client($args)
  18. {
  19. return co_create_instance('Cache','connect',$args);
  20. }
  21. }