PluginProbe
Tutor LMS – eLearning and online course solution / 2.0.7
Tutor LMS – eLearning and online course solution v2.0.7
4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 4.0.0 3.9.15 3.9.14 3.9.13 3.9.12 3.9.11 trunk 1.0.0 1.0.0-alpha 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 All 191 releases
← All changes | cache/AbstractCache.php +17 -18 4.0.42.0.7 View file →
@@ -1,20 +1,20 @@
1 1 <?php
2 2 /**
3 3 * Cache abstract for implementing by the derived class
4 4 *
5 - * @package Tutor\Cache
6 - * @author Themeum <support@themeum.com>
7 - * @link https://themeum.com
8 - * @since 2.0.6
5 + * @package Tutor\Cache
6 + *
7 + * @author Themeum
8 + *
9 + * @since v2.0.6
9 10 */
10 11
11 12 namespace Tutor\Cache;
12 13
13 14 /**
14 - * AbstractCache class
15 - *
16 - * @since 2.0.6
15 + * Containing abstract and regular method for
16 + * caching
17 17 */
18 18 abstract class AbstractCache {
19 19
20 20 /**
@@ -40,10 +40,11 @@
40 40
41 41 /**
42 42 * Set cache data
43 43 *
44 - * @since 2.0.6
45 44 * @return void
45 + *
46 + * @since v2.0.6
46 47 */
47 48 public function set_cache(): void {
48 49 do_action( 'tutor_cache_before_' . $this->key(), $this->cache_data() );
49 50 set_transient( $this->key(), $this->cache_data(), $this->cache_time() );
@@ -52,10 +53,11 @@
52 53
53 54 /**
54 55 * Get user data from cache
55 56 *
56 - * @since 2.0.6
57 57 * @return object cache data
58 + *
59 + * @since v2.0.6
58 60 */
59 61 public function get_cache() {
60 62 $data = get_transient( $this->key() );
61 63 return $data;
@@ -64,10 +66,11 @@
64 66 /**
65 67 * If cache don't have value or expired or not exists
66 68 * will return false
67 69 *
68 - * @since 2.0.6
69 - * @return bool true on success, false on fail
70 + * @return bool | true on success, false on fail
71 + *
72 + * @since v2.0.6
70 73 */
71 74 public function has_cache(): bool {
72 75 return $this->get_cache() ? true : false;
73 76 }
@@ -74,16 +77,12 @@
74 77
75 78 /**
76 79 * Delete cache
77 80 *
78 - * @since 2.0.6
79 81 * @return void
82 + *
83 + * @since v2.0.6
80 84 */
81 85 public function delete_cache(): void {
82 - delete_transient( $this->key() );
83 -
84 - // Clear data after delete cache.
85 - if ( isset( $this->data ) ) {
86 - $this->data = '';
87 - }
86 + delete_transient( $this->key );
88 87 }
89 88 }