@@ -44,16 +44,6 @@ public function __construct($data) {
4444 }
4545
4646 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- }
5747 if (!isset (Common::$ database )) {
5848 Common::$ database = DatabaseDriver::getDatabaseObject ();
5949 }
@@ -72,17 +62,11 @@ public static function getAllProducts() {
7262 if (!$ stmt ->execute ()) {
7363 throw new QueryException ("Cannot refresh products " );
7464 }
75- $ ids = [];
7665 $ objects = [];
7766 while ($ row = $ stmt ->fetch (PDO ::FETCH_OBJ )) {
78- $ ids [] = (int ) $ row ->bnet_product_id ;
7967 $ objects [] = new self ($ row );
80- Common::$ cache ->set (
81- "bnetdocs-product- " . $ row ->bnet_product_id , serialize ($ row ), 300
82- );
8368 }
8469 $ stmt ->closeCursor ();
85- Common::$ cache ->set ($ cache_key , implode (", " , $ ids ), 300 );
8670 return $ objects ;
8771 } catch (PDOException $ e ) {
8872 throw new QueryException ("Cannot refresh products " , $ e );
@@ -136,18 +120,6 @@ protected static function normalize(StdClass &$data) {
136120 }
137121
138122 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- }
151123 if (!isset (Common::$ database )) {
152124 Common::$ database = DatabaseDriver::getDatabaseObject ();
153125 }
@@ -179,7 +151,6 @@ public function refresh() {
179151 $ this ->label = $ row ->label ;
180152 $ this ->sort = $ row ->sort ;
181153 $ this ->version_byte = $ row ->version_byte ;
182- Common::$ cache ->set ($ cache_key , serialize ($ row ), 300 );
183154 return true ;
184155 } catch (PDOException $ e ) {
185156 throw new QueryException ("Cannot refresh product " , $ e );
0 commit comments