| @@ -1,5 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | +/** | |
| 3 | + * @package Polylang | |
| 4 | + */ | |
| 2 | 5 | |
| 3 | 6 | /** |
| 4 | 7 | * An extremely simple non persistent cache system |
| 5 | 8 | * not as fast as using directly an array but more readable |
| @@ -6,11 +9,23 @@ | ||
| 6 | 9 | * |
| 7 | 10 | * @since 1.7 |
| 8 | 11 | */ |
| 9 | 12 | class PLL_Cache { |
| 10 | - protected $blog_id, $cache; | |
| 13 | + /** | |
| 14 | + * Current site id. | |
| 15 | + * | |
| 16 | + * @var int | |
| 17 | + */ | |
| 18 | + protected $blog_id; | |
| 11 | 19 | |
| 12 | 20 | /** |
| 21 | + * The cache container. | |
| 22 | + * | |
| 23 | + * @var array | |
| 24 | + */ | |
| 25 | + protected $cache; | |
| 26 | + | |
| 27 | + /** | |
| 13 | 28 | * Constructor |
| 14 | 29 | * |
| 15 | 30 | * @since 1.7 |
| 16 | 31 | */ |
| @@ -24,8 +39,9 @@ | ||
| 24 | 39 | * |
| 25 | 40 | * @since 1.7 |
| 26 | 41 | * |
| 27 | 42 | * @param int $new_blog |
| 43 | + * @return void | |
| 28 | 44 | */ |
| 29 | 45 | public function switch_blog( $new_blog ) { |
| 30 | 46 | $this->blog_id = $new_blog; |
| 31 | 47 | } |
| @@ -36,8 +52,9 @@ | ||
| 36 | 52 | * @since 1.7 |
| 37 | 53 | * |
| 38 | 54 | * @param string $key |
| 39 | 55 | * @param mixed $data |
| 56 | + * @return void | |
| 40 | 57 | */ |
| 41 | 58 | public function set( $key, $data ) { |
| 42 | 59 | $this->cache[ $this->blog_id ][ $key ] = $data; |
| 43 | 60 | } |
| @@ -59,8 +76,9 @@ | ||
| 59 | 76 | * |
| 60 | 77 | * @since 1.7 |
| 61 | 78 | * |
| 62 | 79 | * @param string $key |
| 80 | + * @return void | |
| 63 | 81 | */ |
| 64 | 82 | public function clean( $key = '' ) { |
| 65 | 83 | if ( empty( $key ) ) { |
| 66 | 84 | unset( $this->cache[ $this->blog_id ] ); |