Overview

Namespaces

  • Kotchasan
    • Cache
    • Database
    • Http
    • Log
    • Orm
  • None
  • PHP
  • Psr
    • Cache
    • Http
      • Message
    • Log

Classes

  • ArrayIterator
  • DateInterval
  • DOMNode
  • Kotchasan
  • Kotchasan\Accordion
  • Kotchasan\ApiController
  • Kotchasan\ArrayTool
  • Kotchasan\Cache\ApcCache
  • Kotchasan\Cache\Cache
  • Kotchasan\Cache\CacheItem
  • Kotchasan\Cache\FileCache
  • Kotchasan\CKEditor
  • Kotchasan\Collection
  • Kotchasan\Config
  • Kotchasan\Controller
  • Kotchasan\Country
  • Kotchasan\Csv
  • Kotchasan\Curl
  • Kotchasan\Currency
  • Kotchasan\Database
  • Kotchasan\Database\Db
  • Kotchasan\Database\DbCache
  • Kotchasan\Database\Driver
  • Kotchasan\Database\PdoMysqlDriver
  • Kotchasan\Database\Query
  • Kotchasan\Database\QueryBuilder
  • Kotchasan\Database\Schema
  • Kotchasan\Database\Sql
  • Kotchasan\DataTable
  • Kotchasan\Date
  • Kotchasan\DOMNode
  • Kotchasan\DOMParser
  • Kotchasan\Email
  • Kotchasan\File
  • Kotchasan\Files
  • Kotchasan\Form
  • Kotchasan\Grid
  • Kotchasan\Html
  • Kotchasan\Htmldoc
  • Kotchasan\HtmlTable
  • Kotchasan\Http\AbstractMessage
  • Kotchasan\Http\AbstractRequest
  • Kotchasan\Http\Message
  • Kotchasan\Http\NotFound
  • Kotchasan\Http\Request
  • Kotchasan\Http\Response
  • Kotchasan\Http\Stream
  • Kotchasan\Http\UploadedFile
  • Kotchasan\Http\Uri
  • Kotchasan\Image
  • Kotchasan\InputItem
  • Kotchasan\Inputs
  • Kotchasan\KBase
  • Kotchasan\Language
  • Kotchasan\ListItem
  • Kotchasan\Log\AbstractLogger
  • Kotchasan\Log\Logger
  • Kotchasan\Login
  • Kotchasan\Menu
  • Kotchasan\Mime
  • Kotchasan\Model
  • Kotchasan\Number
  • Kotchasan\ObjectTool
  • Kotchasan\Orm\Field
  • Kotchasan\Orm\Recordset
  • Kotchasan\Password
  • Kotchasan\Pdf
  • Kotchasan\Province
  • Kotchasan\Router
  • Kotchasan\Session
  • Kotchasan\Singleton
  • Kotchasan\Tab
  • Kotchasan\TableRow
  • Kotchasan\Template
  • Kotchasan\Text
  • Kotchasan\Validator
  • Kotchasan\View
  • PHPMailer
  • Psr\Log\AbstractLogger
  • Psr\Log\LogLevel
  • Psr\Log\NullLogger
  • SMTP

Interfaces

  • ArrayAccess
  • Countable
  • DateTimeInterface
  • Iterator
  • IteratorAggregate
  • Psr\Cache\CacheItemInterface
  • Psr\Cache\CacheItemPoolInterface
  • Psr\Http\Message\MessageInterface
  • Psr\Http\Message\RequestInterface
  • Psr\Http\Message\ResponseInterface
  • Psr\Http\Message\ServerRequestInterface
  • Psr\Http\Message\StreamInterface
  • Psr\Http\Message\UploadedFileInterface
  • Psr\Http\Message\UriInterface
  • Psr\Log\LoggerAwareInterface
  • Psr\Log\LoggerInterface
  • SeekableIterator
  • Serializable
  • Traversable

Traits

  • Psr\Log\LoggerTrait

Exceptions

  • Exception
  • InvalidArgumentException
  • Kotchasan\ApiException
  • Kotchasan\Cache\Exception
  • Kotchasan\Database\Exception
  • Kotchasan\InputItemException
  • LogicException
  • phpmailerException
  • RuntimeException

Functions

  • createClass
  • debug
  • getClassPath
  • Overview
  • Namespace
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * @filesource  Kotchasan/Cache/CacheItem.php
  4:  *
  5:  * @copyright 2016 Goragod.com
  6:  * @license http://www.kotchasan.com/license/
  7:  *
  8:  * @see http://www.kotchasan.com/
  9:  */
 10: 
 11: namespace Kotchasan\Cache;
 12: 
 13: use Psr\Cache\CacheItemInterface;
 14: 
 15: /**
 16:  * Cache Item.
 17:  *
 18:  * @author Goragod Wiriya <admin@goragod.com>
 19:  *
 20:  * @since 1.0
 21:  */
 22: class CacheItem implements CacheItemInterface
 23: {
 24:     /**
 25:      * @var bool
 26:      */
 27:     private $hit;
 28:     /**
 29:      * Cache Key.
 30:      *
 31:      * @var string
 32:      */
 33:     private $key;
 34:     /**
 35:      * Cache value.
 36:      *
 37:      * @var mixed
 38:      */
 39:     private $value;
 40: 
 41:     /**
 42:      * Class constructor.
 43:      *
 44:      * @param string $key Cache Key
 45:      */
 46:     public function __construct($key)
 47:     {
 48:         $this->key = $key;
 49:         $this->value = null;
 50:         $this->hit = false;
 51:     }
 52: 
 53:     /**
 54:      * กำหนดอายุของแคช (วินาที).
 55:      *
 56:      * @param int|\DateInterval $time
 57:      *
 58:      * @return \static
 59:      */
 60:     public function expiresAfter($time)
 61:     {
 62:     }
 63: 
 64:     /**
 65:      * กำหนดวันที่และเวลาหมดอายุของแคช.
 66:      *
 67:      * @param \DateTimeInterface $expiration
 68:      *
 69:      * @return \static
 70:      */
 71:     public function expiresAt($expiration)
 72:     {
 73:     }
 74: 
 75:     /**
 76:      * อ่านค่าของแคช.
 77:      *
 78:      * @return mixed
 79:      */
 80:     public function get()
 81:     {
 82:         return $this->value;
 83:     }
 84: 
 85:     /**
 86:      * อ่านค่าคีย์ของแคช.
 87:      *
 88:      * @return string
 89:      */
 90:     public function getKey()
 91:     {
 92:         return $this->key;
 93:     }
 94: 
 95:     /**
 96:      * ฟังก์ชั่นตรวจสอบว่ามีการกำหนดข้อมูลลงในแคชหรือไม่
 97:      * คืนค่า true ถ้ามีการใส่ value ในแคชแล้ว.
 98:      *
 99:      * @return bool
100:      */
101:     public function isHit()
102:     {
103:         return $this->hit;
104:     }
105: 
106:     /**
107:      * กำหนดค่า.
108:      *
109:      * @param mixed $value
110:      *
111:      * @return \static
112:      */
113:     public function set($value)
114:     {
115:         $this->value = $value;
116:         $this->hit = true;
117: 
118:         return $this;
119:     }
120: }
121: 
Kotchasan API documentation generated by ApiGen