!--? 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.