<?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
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
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
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
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
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.
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
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!
Hot Tools
PHP library for dependency injection containers
PHP library for dependency injection containers
A collection of 50 excellent classic PHP algorithms
Classic PHP algorithm, learn excellent ideas and expand your thinking
Small PHP library for optimizing images
Small PHP library for optimizing images