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 counter service
13:  *
14:  * @author      Twin Huang <twinhuang@qq.com>
15:  * @property    Cache $cache A cache service
16:  */
17: class Counter extends Base
18: {
19:     /**
20:      * Increment an item
21:      *
22:      * @param string $key The name of item
23:      * @param int $offset The value to increased
24:      * @return int|false Returns the new value on success, or false on failure
25:      */
26:     public function incr($key, $offset = 1)
27:     {
28:         return $this->cache->incr($key, $offset);
29:     }
30: 
31:     /**
32:      * Decrement an item
33:      *
34:      * @param string $key The name of item
35:      * @param int $offset The value to be decreased
36:      * @return int|false Returns the new value on success, or false on failure
37:      */
38:     public function decr($key, $offset = 1)
39:     {
40:         return $this->cache->decr($key, $offset);
41:     }
42: 
43:     /**
44:      * Retrieve an item
45:      *
46:      * @param string $key The name of item
47:      * @return mixed
48:      */
49:     public function get($key)
50:     {
51:         return $this->cache->get($key);
52:     }
53: 
54:     /**
55:      * Store an item
56:      *
57:      * @param string $key The name of item
58:      * @param mixed $value The value of item
59:      * @return bool
60:      */
61:     public function set($key, $value)
62:     {
63:         return $this->cache->set($key, $value);
64:     }
65: 
66:     /**
67:      * Check if an item is exists
68:      *
69:      * @param string $key
70:      * @return bool
71:      */
72:     public function exits($key)
73:     {
74:         return $this->cache->exists($key);
75:     }
76: 
77:     /**
78:      * Remove an item
79:      *
80:      * @param  string $key The name of item
81:      * @return bool
82:      */
83:     public function remove($key)
84:     {
85:         return $this->cache->remove($key);
86:     }
87: }
Wei Framework API documentation generated by ApiGen