search
HomePHP LibrariesOther librariesCache class library implemented in PHP
Cache class library implemented in PHP
<?php
class Cache {
  private $dir;
  private $lifetime;
  private $cacheid;
  private $ext;
  function __construct($dir='',$lifetime=1800) {
    if ($this->dir_isvalid($dir)) {
      $this->dir = $dir;
      $this->lifetime = $lifetime;
      $this->ext = '.Php';
      $this->cacheid = $this->getcacheid();
    }
  }
  private function isvalid() {
    if (!file_exists($this->cacheid)) return false;
    if (!(@$mtime = filemtime($this->cacheid))) return false;
    if (mktime() - $mtime > $this->lifetime) return false;
    return true;
  }

This is a cache class library implemented in PHP. Friends who need it can download and use

Disclaimer

All resources on this site are contributed by netizens or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this site are for learning reference only. Please do not use them for commercial purposes. Otherwise, you will be responsible for all consequences! If there is any infringement, please contact us to delete it. Contact information: admin@php.cn

Related Article

XML operation class implemented by PHP [XML Library]XML operation class implemented by PHP [XML Library]

06Jan2017

This article mainly introduces the XML operation class implemented by PHP, involving PHP's conversion, serialization, deserialization and other related operation skills for arrays and xml. Friends in need can refer to the following

Redis multi-library selection function singleton class code sharing implemented in PHPRedis multi-library selection function singleton class code sharing implemented in PHP

08Sep2017

This article mainly introduces the singleton class of the Redis multi-library selection function implemented by PHP. It analyzes the multi-library selection function of the Redis database using singleton mode in PHP based on the example form. Friends in need can refer to the following

Encapsulated cache class implemented as a cache through redis in nodejsEncapsulated cache class implemented as a cache through redis in nodejs

07Jun2018

This article mainly introduces the encapsulated cache class implemented by nodejs using redis as the cache medium, and involves the operation skills related to nodejs operating redis for cache settings. Friends in need can refer to the following

Is there any PHP class library and function module sharing website in China similar to phpclasses?Is there any PHP class library and function module sharing website in China similar to phpclasses?

11Oct2016

Question: Are there any PHP class libraries and functional module sharing websites in China similar to phpclasses? Just take some extensions and you can use or learn them directly.

Complete example explanation of mongoDB database operation class implemented in PHPComplete example explanation of mongoDB database operation class implemented in PHP

27Jun2018

This article mainly introduces the mongoDB database operation class implemented by PHP. It combines the complete example form with a detailed analysis of PHP's implementation techniques for mongoDB database connection, addition, deletion, modification, statistics and other operations based on the singleton mode. Friends in need can refer to the following

Example of machine learning class library implemented in front-end JavascriptExample of machine learning class library implemented in front-end Javascript

09Feb2018

The entire system of the Web has developed significantly in recent years, although the use cases of Javascript and node.js are still far from comparable to Java/Python. But it is enough to be applied to many machine learning environments. And the biggest advantage is - one browser can do it all for you!

See all articles