Home PHP Libraries Other libraries Simple and efficient file caching php class
Simple and efficient file caching php class
<?php
class FileCache  
{   
    public $keyPrefix = '';   
    public $cachePath = '';   
    public $cacheFileSuffix = '.bin';   
    public $directoryLevel = 1;    
    public $gcProbability = 10;  
    public $fileMode;   
    public $dirMode = 0775;  
    function __construct()  
    {  
        $this->cachePath = HT::$cacheRoot.'htcache';  
    }  
  
    function FileCache()  
    {  
        $this->__construct();  
    }

$dir: cache file storage directory

$lifetime: cache file validity period, in seconds

$cacheid: cache file path, including file name

$ext: Cache file extension (can be omitted), used here for the convenience of viewing the file

Destructor, check whether the cache directory is valid, default assignment, check Whether the cache is valid, write the cache

$mode == 0, obtain the page content through the browser cache

$mode == 1, use direct assignment (received through the $content parameter) Get the page content by

$mode == 2, get the page content by reading locally (fopen ile_get_contents) (it seems that this method is unnecessary)



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

How to Implement Efficient Multiple File Uploads with PHP and jQuery? How to Implement Efficient Multiple File Uploads with PHP and jQuery?

25 Oct 2024

Uploading Multiple Files Effectively with PHP and jQueryWhile working with PHP, you may encounter situations where you need to upload multiple...

How Do I Link Static Libraries That Depend on Other Static Libraries? How Do I Link Static Libraries That Depend on Other Static Libraries?

13 Dec 2024

Linking Static Libraries to Other Static Libraries: A Comprehensive ApproachStatic libraries provide a convenient mechanism to package reusable...

PHP common file operation functions and simple example analysis, _PHP tutorial PHP common file operation functions and simple example analysis, _PHP tutorial

12 Jul 2016

PHP common file operation functions and simple example analysis. PHP common file operation functions and simple example analysis. The most commonly used file operations in PHP are reading and writing. Today I will mainly explain the reading and writing functions, and make a page access.

Simple paging class and usage examples implemented in PHP, php paging usage examples_PHP tutorial Simple paging class and usage examples implemented in PHP, php paging usage examples_PHP tutorial

12 Jul 2016

Simple paging class implemented in PHP and usage examples, PHP paging usage examples. Simple paging class and usage examples implemented in PHP, PHP paging usage examples This article describes the simple paging class and usage examples implemented in PHP. Share it with everyone for your reference, the details are as follows: php/

How to Implement a Simple File Upload Using jQuery AJAX and PHP? How to Implement a Simple File Upload Using jQuery AJAX and PHP?

24 Dec 2024

jQuery AJAX File Upload with PHPIssue: Implementing a simple file upload with minimal setup using jQuery AJAX and PHP.Initial HTML and JavaScript...

Multi-file upload class implemented in PHP and usage examples, _PHP tutorial Multi-file upload class implemented in PHP and usage examples, _PHP tutorial

12 Jul 2016

Multi-file upload class implemented in PHP and usage examples. Multi-file upload class and usage examples implemented in PHP. This article describes the multi-file upload class and usage examples implemented in PHP. Share it with everyone for your reference, the details are as follows: 1. upFiles.css.php

See all articles