PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.9
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.9
4.4.9 4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 All 140 releases
← All changes | inc/cache/class-lp-cache.php +17 -5 4.4.7 → 4.4.9 View file →
@@ -32,9 +32,14 @@
32 32 * Set/Update will check key from table thim_cache
33 33 * else only WP Cache
34 34 */
35 35 public function __construct( $has_thim_cache = false ) {
36 - $this->key_group = $this->key_group_parent . '/' . $this->key_group_child;
36 + $this->key_group = $this->key_group_parent;
37 +
38 + if ( ! empty( $this->key_group_child ) ) {
39 + $this->key_group .= '/' . $this->key_group_child;
40 + }
41 +
37 42 $this->has_thim_cache = $has_thim_cache;
38 43 }
39 44
40 45 /**
@@ -53,9 +58,15 @@
53 58 wp_cache_set( $key, $data, $this->key_group, $expire );
54 59 // Cache thim_cache
55 60 if ( $this->can_handle_with_thim_cache() ) {
56 61 $key = "{$this->key_group}/{$key}";
57 - Thim_Cache_DB::instance()->set_value( $key, $data, $expire );
62 +
63 + if ( ! is_string( $data ) ) {
64 + $data = wp_json_encode( $data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES );
65 + }
66 +
67 + $expiration = $expire > 0 ? time() + $expire : 0;
68 + Thim_Cache_DB::instance()->set_value( $key, $data, $expiration );
58 69 }
59 70 } catch ( Throwable $e ) {
60 71 LP_Debug::error_log( $e );
61 72 }
@@ -73,11 +84,12 @@
73 84 // Get thim_cache
74 85 if ( false === $cache && $this->can_handle_with_thim_cache() ) {
75 86 $key = "{$this->key_group}/{$key}";
76 87 $cache = Thim_Cache_DB::instance()->get_value( $key );
77 - /*if ( is_string( $cache ) ) {
78 - $cache = wp_unslash( $cache );
79 - }*/
88 + try {
89 + $cache = LP_Helper::json_decode( $cache, true );
90 + } catch ( Throwable $e ) {
91 + }
80 92 }
81 93
82 94 return $cache;
83 95 }