Skip to content

Commit

Permalink
将transient改为wp_cache储存缓存 (#137)
Browse files Browse the repository at this point in the history
* Update class.json.php

将transient改为wp_cache储存缓存

* Update hermit.php
  • Loading branch information
fantastlcok authored and lwl12 committed Jan 22, 2019
1 parent eb07dd2 commit 144ebbb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions class.json.php
Original file line number Diff line number Diff line change
Expand Up @@ -433,19 +433,19 @@ public function curl($API)

public function get_cache($key)
{
$cache = get_transient($key);
$cache = wp_cache_get( $key, 'hermitx' );
return $cache === false ? false : json_decode($cache, true);
}

public function set_cache($key, $value, $hour = 0.1)
{
$value = json_encode($value);
set_transient($key, $value, 60 * 60 * $hour);
wp_cache_set( $key, $value, 'hermitx', 60 * 60 * $hour );
}

public function clear_cache($key)
{
//delete_transient($key);
//wp_cache_delete($key, 'hermitx');
}

/**
Expand Down
4 changes: 2 additions & 2 deletions hermit.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
Plugin Name: Hermit X
Plugin URI: https://blog.lwl12.com/read/hermit-x.html
Description: 音乐播放器 Hermit music player build for wordpress with APlayer
Version: 2.9.4
Version: 2.9.5
Author: Hermit X Developer Team
Author URI: https://blog.lwl12.com/read/hermit-x.html#developer
*/

define('HERMIT_FILE', __FILE__);
define('HERMIT_VERSION', '2.9.4');
define('HERMIT_VERSION', '2.9.5');
define('HERMIT_URL', plugins_url('', __FILE__));
define('HERMIT_PATH', dirname(__FILE__));
define('HERMIT_ADMIN_URL', admin_url());
Expand Down

0 comments on commit 144ebbb

Please sign in to comment.