Redis-based JS, CSS cache classes

Source: Internet
Author: User
!--? php/** the Redis-based JS, CSS cache class (effective to solve various problems such as TP, etc.) *written by Radish 2015.8.16*/define (& #39; redis_host& #39, and #39, 127.0.0.1& #39;);d efine (& #39; redis_port& #39;, 6379);//class im{function __construct () {$ This--->redis = new Redis (); $this->redis->connect (Redis_host,redis_port);} Public function init ($array =[]) {if ($this->redis->get (' updated ') ==1) Return;foreach ($array as $k = = $v) {if ($v [0]== ' JS ') $this->redis->set ($k, '); if ($v [0]== ' CSS ') $this->redis->set ($k, '  ');} $this->redis->set (' updated ', 1);} Public function Get ($c {echo $this->redis->get (' jquery ');}} $setup =[' jquery ' =>[' js ', ' http://lib.sinaapp.com/js/jquery/1.9.1/jquery-1.9.1.min.js ', ' Amazeui ' =>[' CSS ', ' Http://cdn.amazeui.org/amazeui/2.4.2/css/amazeui.css ', ' angular ' =>[' js ', ' http://lib.sinaapp.com/js/ Angular.js/angular-1.2.19/angular-animate.min.js ']; $k =new im (); $k->init ($setup); $k->get (' jquery '); 

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

The above describes the Redis-based JS, CSS cache class, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.