@@ -44,16 +44,6 @@ public function __construct($data) {
44
44
}
45
45
46
46
public static function getAllProducts () {
47
- $ cache_key = "bnetdocs-products " ;
48
- $ cache_val = Common::$ cache ->get ($ cache_key );
49
- if ($ cache_val !== false && !empty ($ cache_val )) {
50
- $ ids = explode (", " , $ cache_val );
51
- $ objects = [];
52
- foreach ($ ids as $ id ) {
53
- $ objects [] = new self ($ id );
54
- }
55
- return $ objects ;
56
- }
57
47
if (!isset (Common::$ database )) {
58
48
Common::$ database = DatabaseDriver::getDatabaseObject ();
59
49
}
@@ -72,17 +62,11 @@ public static function getAllProducts() {
72
62
if (!$ stmt ->execute ()) {
73
63
throw new QueryException ("Cannot refresh products " );
74
64
}
75
- $ ids = [];
76
65
$ objects = [];
77
66
while ($ row = $ stmt ->fetch (PDO ::FETCH_OBJ )) {
78
- $ ids [] = (int ) $ row ->bnet_product_id ;
79
67
$ objects [] = new self ($ row );
80
- Common::$ cache ->set (
81
- "bnetdocs-product- " . $ row ->bnet_product_id , serialize ($ row ), 300
82
- );
83
68
}
84
69
$ stmt ->closeCursor ();
85
- Common::$ cache ->set ($ cache_key , implode (", " , $ ids ), 300 );
86
70
return $ objects ;
87
71
} catch (PDOException $ e ) {
88
72
throw new QueryException ("Cannot refresh products " , $ e );
@@ -136,18 +120,6 @@ protected static function normalize(StdClass &$data) {
136
120
}
137
121
138
122
public function refresh () {
139
- $ cache_key = "bnetdocs-product- " . $ this ->bnet_product_id ;
140
- $ cache_val = Common::$ cache ->get ($ cache_key );
141
- if ($ cache_val !== false ) {
142
- $ cache_val = unserialize ($ cache_val );
143
- $ this ->bnet_product_id = $ cache_val ->bnet_product_id ;
144
- $ this ->bnet_product_raw = $ cache_val ->bnet_product_raw ;
145
- $ this ->bnls_product_id = $ cache_val ->bnls_product_id ;
146
- $ this ->label = $ cache_val ->label ;
147
- $ this ->sort = $ cache_val ->sort ;
148
- $ this ->version_byte = $ cache_val ->version_byte ;
149
- return true ;
150
- }
151
123
if (!isset (Common::$ database )) {
152
124
Common::$ database = DatabaseDriver::getDatabaseObject ();
153
125
}
@@ -179,7 +151,6 @@ public function refresh() {
179
151
$ this ->label = $ row ->label ;
180
152
$ this ->sort = $ row ->sort ;
181
153
$ this ->version_byte = $ row ->version_byte ;
182
- Common::$ cache ->set ($ cache_key , serialize ($ row ), 300 );
183
154
return true ;
184
155
} catch (PDOException $ e ) {
185
156
throw new QueryException ("Cannot refresh product " , $ e );
0 commit comments