PluginProbe
StoreEngine — Complete eCommerce Solution with Memberships, Licensing, Affiliates & More / 2.2.0
StoreEngine — Complete eCommerce Solution with Memberships, Licensing, Affiliates & More v2.2.0
2.3.0 2.2.0 2.1.1 2.1.0 2.0.0 1.10.0 1.9.1 1.9.0 1.2.1 1.2.2 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6.0 All 59 releases
storeengine / includes / classes / cache / order-cache.php

order-cache.php in StoreEngine — Complete eCommerce Solution with Memberships, Licensing, Affiliates & More 2.2.0, at includes/classes/cache/order-cache.php

93 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace StoreEngine\Classes\Cache;
4
5 use StoreEngine\Utils\Helper;
6
7 /**
8 * @deprecated
9 * @use \StoreEngine\Utils\Caching
10 */
11 class OrderCache {
12 private const KEY = 'storeengine_order_cache_';
13 private const GROUP = 'storeengine_order_cache';
14
15 public static function set( $id, $data ) {
16 wp_cache_set( self::KEY . $id, $data, self::GROUP );
17 }
18
19 public static function set_by_key( $key, $data ) {
20 wp_cache_set( self::KEY . $key, $data, self::GROUP );
21 }
22
23 public static function set_draft_order( $data ) {
24 wp_cache_set( self::KEY . 'draft_' . Helper::get_cart_hash_from_cookie(), $data, self::GROUP );
25 }
26
27 public static function set_items( $id, $data ) {
28 wp_cache_set( self::KEY . $id . 'items', $data, self::GROUP );
29 }
30
31 public static function set_coupons( $id, $data ) {
32 wp_cache_set( self::KEY . $id . 'coupons', $data, self::GROUP );
33 }
34
35 public static function set_refunds( $id, $data ) {
36 wp_cache_set( self::KEY . $id . 'refunds', $data, self::GROUP );
37 }
38
39 public static function get( int $id ) {
40 return wp_cache_get( self::KEY . $id, self::GROUP );
41 }
42
43 public static function get_by_key( string $key ) {
44 return wp_cache_get( self::KEY . $key, self::GROUP );
45 }
46
47 public static function get_draft_order( $cart_hash = null ) {
48 $cart_hash = ! $cart_hash ? Helper::get_cart_hash_from_cookie() : $cart_hash;
49
50 return wp_cache_get( self::KEY . 'draft_' . $cart_hash, self::GROUP );
51 }
52
53 public static function get_items( $id ) {
54 return wp_cache_get( self::KEY . $id . 'items', self::GROUP );
55 }
56
57 public static function get_coupons( $id ) {
58 return wp_cache_get( self::KEY . $id . 'coupons', self::GROUP );
59 }
60
61 public static function get_refunds( $id ) {
62 return wp_cache_get( self::KEY . $id . 'refunds', self::GROUP );
63 }
64
65 public static function delete( $id ) {
66 wp_cache_delete( self::KEY . $id, self::GROUP );
67 }
68
69 public static function delete_by_key( string $key ) {
70 wp_cache_delete( self::KEY . $key, self::GROUP );
71 }
72
73 public static function delete_draft_order() {
74 wp_cache_delete( self::KEY . 'draft_' . Helper::get_cart_hash_from_cookie(), self::GROUP );
75 }
76
77 public static function delete_items( $id ) {
78 wp_cache_delete( self::KEY . $id . 'items', self::GROUP );
79 }
80
81 public static function delete_coupons( $id ) {
82 wp_cache_delete( self::KEY . $id . 'coupons', self::GROUP );
83 }
84
85 public static function delete_refunds( $id ) {
86 wp_cache_delete( self::KEY . $id . 'refunds', self::GROUP );
87 }
88
89 public static function flush() {
90 wp_cache_flush_group( self::GROUP );
91 }
92 }
93