@@ -66,16 +66,6 @@ public function getAddress() {
66
66
}
67
67
68
68
public static function getAllServers () {
69
- $ cache_key = "bnetdocs-servers " ;
70
- $ cache_val = Common::$ cache ->get ($ cache_key );
71
- if ($ cache_val !== false && !empty ($ cache_val )) {
72
- $ ids = explode (", " , $ cache_val );
73
- $ objects = [];
74
- foreach ($ ids as $ id ) {
75
- $ objects [] = new self ($ id );
76
- }
77
- return $ objects ;
78
- }
79
69
if (!isset (Common::$ database )) {
80
70
Common::$ database = DatabaseDriver::getDatabaseObject ();
81
71
}
@@ -102,17 +92,11 @@ public static function getAllServers() {
102
92
if (!$ stmt ->execute ()) {
103
93
throw new QueryException ("Cannot refresh servers " );
104
94
}
105
- $ ids = [];
106
95
$ objects = [];
107
96
while ($ row = $ stmt ->fetch (PDO ::FETCH_OBJ )) {
108
- $ ids [] = (int ) $ row ->id ;
109
97
$ objects [] = new self ($ row );
110
- Common::$ cache ->set (
111
- "bnetdocs-server- " . $ row ->id , serialize ($ row ), 300
112
- );
113
98
}
114
99
$ stmt ->closeCursor ();
115
- Common::$ cache ->set ($ cache_key , implode (", " , $ ids ), 300 );
116
100
return $ objects ;
117
101
} catch (PDOException $ e ) {
118
102
throw new QueryException ("Cannot refresh servers " , $ e );
@@ -174,14 +158,9 @@ public static function getServersByUserId($user_id) {
174
158
if (!$ stmt ->execute ()) {
175
159
throw new QueryException ('Cannot query servers by user id ' );
176
160
}
177
- $ ids = [];
178
161
$ objects = [];
179
162
while ($ row = $ stmt ->fetch (PDO ::FETCH_OBJ )) {
180
- $ ids [] = (int ) $ row ->id ;
181
163
$ objects [] = new self ($ row );
182
- Common::$ cache ->set (
183
- 'bnetdocs-server- ' . $ row ->id , serialize ($ row ), 300
184
- );
185
164
}
186
165
$ stmt ->closeCursor ();
187
166
return $ objects ;
@@ -292,20 +271,6 @@ protected static function normalize(StdClass &$data) {
292
271
}
293
272
294
273
public function refresh () {
295
- $ cache_key = "bnetdocs-server- " . $ this ->id ;
296
- $ cache_val = Common::$ cache ->get ($ cache_key );
297
- if ($ cache_val !== false ) {
298
- $ cache_val = unserialize ($ cache_val );
299
- $ this ->address = $ cache_val ->address ;
300
- $ this ->created_datetime = $ cache_val ->created_datetime ;
301
- $ this ->label = $ cache_val ->label ;
302
- $ this ->port = $ cache_val ->port ;
303
- $ this ->status_bitmask = $ cache_val ->status_bitmask ;
304
- $ this ->type_id = $ cache_val ->type_id ;
305
- $ this ->updated_datetime = $ cache_val ->updated_datetime ;
306
- $ this ->user_id = $ cache_val ->user_id ;
307
- return true ;
308
- }
309
274
if (!isset (Common::$ database )) {
310
275
Common::$ database = DatabaseDriver::getDatabaseObject ();
311
276
}
@@ -342,7 +307,6 @@ public function refresh() {
342
307
$ this ->type_id = $ row ->type_id ;
343
308
$ this ->updated_datetime = $ row ->updated_datetime ;
344
309
$ this ->user_id = $ row ->user_id ;
345
- Common::$ cache ->set ($ cache_key , serialize ($ row ), 300 );
346
310
return true ;
347
311
} catch (PDOException $ e ) {
348
312
throw new QueryException ("Cannot refresh server " , $ e );
@@ -396,22 +360,6 @@ public function save() {
396
360
throw new QueryException ( 'Cannot save server ' );
397
361
}
398
362
$ stmt ->closeCursor ();
399
-
400
- $ object = new StdClass ();
401
- $ object ->address = $ this ->address ;
402
- $ object ->created_datetime = $ this ->created_datetime ;
403
- $ object ->id = $ this ->id ;
404
- $ object ->label = $ this ->label ;
405
- $ object ->port = $ this ->port ;
406
- $ object ->status_bitmask = $ this ->status_bitmask ;
407
- $ object ->type_id = $ this ->type_id ;
408
- $ object ->updated_datetime = $ this ->updated_datetime ;
409
- $ object ->user_id = $ this ->user_id ;
410
-
411
- $ cache_key = 'bnetdocs-server- ' . $ this ->id ;
412
- Common::$ cache ->set ( $ cache_key , serialize ( $ object ), 300 );
413
- Common::$ cache ->delete ( 'bnetdocs-servers ' );
414
-
415
363
return true ;
416
364
417
365
} catch ( PDOException $ e ) {
0 commit comments