Skip to content

Commit dea47a7

Browse files
committed
Remove cache from Event class
1 parent eb3ae8f commit dea47a7

File tree

1 file changed

+0
-44
lines changed

1 file changed

+0
-44
lines changed

src/libraries/Event.php

-44
Original file line numberDiff line numberDiff line change
@@ -55,26 +55,6 @@ public static function &getAllEvents(
5555
$limit_clause = 'LIMIT ' . (int) $index . ',' . (int) $limit;
5656
}
5757

58-
if (empty($limit_clause)) {
59-
60-
$cache_key = 'bnetdocs-events-' . hash( 'md5', $where_clause );
61-
$cache_val = Common::$cache->get( $cache_key );
62-
63-
if ( $cache_val !== false && !empty( $cache_val ) ) {
64-
65-
$ids = explode( ',', $cache_val );
66-
$objects = [];
67-
68-
foreach ( $ids as $id ) {
69-
$objects[] = new self($id);
70-
}
71-
72-
return $objects;
73-
74-
}
75-
76-
}
77-
7858
if ( !isset(Common::$database) ) {
7959
Common::$database = DatabaseDriver::getDatabaseObject();
8060
}
@@ -99,23 +79,12 @@ public static function &getAllEvents(
9979
throw new QueryException( 'Cannot refresh all events' );
10080
}
10181

102-
$ids = [];
10382
$objects = [];
104-
10583
while ( $row = $stmt->fetch( PDO::FETCH_OBJ ) ) {
106-
$ids[] = (int) $row->id;
10784
$objects[] = new self( $row );
108-
Common::$cache->set(
109-
'bnetdocs-event-' . $row->id, serialize( $row ), 300
110-
);
11185
}
11286

11387
$stmt->closeCursor();
114-
115-
if ( empty( $limit_clause ) ) {
116-
Common::$cache->set( $cache_key, implode( ',', $ids ), 300 );
117-
}
118-
11988
return $objects;
12089

12190
} catch ( PDOException $e ) {
@@ -235,14 +204,6 @@ protected static function normalize(StdClass &$data, Event &$self = null ) {
235204

236205
public function refresh() {
237206

238-
$cache_key = 'bnetdocs-event-' . $this->id;
239-
$cache_val = Common::$cache->get( $cache_key );
240-
241-
if ( $cache_val !== false ) {
242-
$cache_val = unserialize( $cache_val );
243-
return self::normalize( $cache_val , $this );
244-
}
245-
246207
if ( !isset( Common::$database ) ) {
247208
Common::$database = DatabaseDriver::getDatabaseObject();
248209
}
@@ -272,18 +233,13 @@ public function refresh() {
272233
$stmt->closeCursor();
273234
self::normalize( $row, $this );
274235

275-
Common::$cache->set( $cache_key, serialize( $row ), 300 );
276-
277236
return true;
278237

279238
} catch ( PDOException $e ) {
280-
281239
throw new QueryException( 'Cannot refresh event', $e );
282-
283240
}
284241

285242
return false;
286-
287243
}
288244

289245
}

0 commit comments

Comments
 (0)