Overview

Namespaces

  • None
  • Wei
    • Validator

Classes

  • Wei\Validator\All
  • Wei\Validator\AllOf
  • Wei\Validator\Alnum
  • Wei\Validator\Alpha
  • Wei\Validator\BaseValidator
  • Wei\Validator\Between
  • Wei\Validator\Blank
  • Wei\Validator\Callback
  • Wei\Validator\CharLength
  • Wei\Validator\Chinese
  • Wei\Validator\Color
  • Wei\Validator\Contains
  • Wei\Validator\CreditCard
  • Wei\Validator\Date
  • Wei\Validator\DateTime
  • Wei\Validator\Decimal
  • Wei\Validator\Digit
  • Wei\Validator\Dir
  • Wei\Validator\DivisibleBy
  • Wei\Validator\DoubleByte
  • Wei\Validator\Email
  • Wei\Validator\EndsWith
  • Wei\Validator\EqualTo
  • Wei\Validator\Exists
  • Wei\Validator\FieldExists
  • Wei\Validator\File
  • Wei\Validator\GreaterThan
  • Wei\Validator\GreaterThanOrEqual
  • Wei\Validator\IdCardCn
  • Wei\Validator\IdCardHk
  • Wei\Validator\IdCardMo
  • Wei\Validator\IdCardTw
  • Wei\Validator\IdenticalTo
  • Wei\Validator\Image
  • Wei\Validator\In
  • Wei\Validator\Ip
  • Wei\Validator\Length
  • Wei\Validator\LessThan
  • Wei\Validator\LessThanOrEqual
  • Wei\Validator\Lowercase
  • Wei\Validator\Luhn
  • Wei\Validator\MaxLength
  • Wei\Validator\MinLength
  • Wei\Validator\MobileCn
  • Wei\Validator\NaturalNumber
  • Wei\Validator\NoneOf
  • Wei\Validator\Null
  • Wei\Validator\Number
  • Wei\Validator\OneOf
  • Wei\Validator\Password
  • Wei\Validator\Phone
  • Wei\Validator\PhoneCn
  • Wei\Validator\PlateNumberCn
  • Wei\Validator\PositiveInteger
  • Wei\Validator\PostcodeCn
  • Wei\Validator\Present
  • Wei\Validator\QQ
  • Wei\Validator\RecordExists
  • Wei\Validator\Regex
  • Wei\Validator\Required
  • Wei\Validator\SomeOf
  • Wei\Validator\StartsWith
  • Wei\Validator\Time
  • Wei\Validator\Tld
  • Wei\Validator\Type
  • Wei\Validator\Uppercase
  • Wei\Validator\Url
  • Wei\Validator\Uuid
  • Overview
  • Namespace
  • Function
 1: <?php
 2: /**
 3:  * Wei Framework
 4:  *
 5:  * @copyright   Copyright (c) 2008-2015 Twin Huang
 6:  * @license     http://opensource.org/licenses/mit-license.php MIT License
 7:  */
 8: 
 9: namespace Wei;
10: 
11: /**
12:  * A cache service that stored data in PHP APC
13:  *
14:  * @author      Twin Huang <twinhuang@qq.com>
15:  */
16: class Apc extends BaseCache
17: {
18:     /**
19:      * {@inheritdoc}
20:      */
21:     public function get($key, $expire = null, $fn = null)
22:     {
23:         $result = apc_fetch($this->namespace . $key);
24:         return $this->processGetResult($key, $result, $expire, $fn);
25:     }
26: 
27:     /**
28:      * {@inheritdoc}
29:      */
30:     public function set($key, $value, $expire = 0)
31:     {
32:         $key = $this->namespace . $key;
33:         return $expire >= 0 ? apc_store($key, $value, $expire) : apc_delete($key);
34:     }
35: 
36:     /**
37:      * {@inheritdoc}
38:      */
39:     public function remove($key)
40:     {
41:         return apc_delete($this->namespace . $key);
42:     }
43: 
44:     /**
45:      * {@inheritdoc}
46:      */
47:     public function exists($key)
48:     {
49:         return apc_exists($this->namespace . $key);
50:     }
51: 
52:     /**
53:      * {@inheritdoc}
54:      */
55:     public function add($key, $value, $expire = 0)
56:     {
57:         return apc_add($this->namespace . $key, $value, $expire);
58:     }
59: 
60:     /**
61:      * {@inheritdoc}
62:      */
63:     public function replace($key, $value, $expire = 0)
64:     {
65:         $key = $this->namespace . $key;
66:         if (apc_exists($key)) {
67:             return apc_store($key, $value, $expire);
68:         } else {
69:             return false;
70:         }
71:     }
72: 
73:     /**
74:      * {@inheritdoc}
75:      */
76:     public function incr($key, $offset = 1)
77:     {
78:         $key = $this->namespace . $key;
79:         $value = apc_inc($key, $offset, $success);
80:         if ($success) {
81:             return $value;
82:         } else {
83:             return apc_store($key, $offset) ? $offset : false;
84:         }
85:     }
86: 
87:     /**
88:      * {@inheritdoc}
89:      */
90:     public function clear()
91:     {
92:         return apc_clear_cache('user');
93:     }
94: }
95: 
Wei Framework API documentation generated by ApiGen