Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SqlStore2IdCache.php |
— | — | @@ -43,6 +43,7 @@ |
44 | 44 | 'smw_subobject' => $subobject ); |
45 | 45 | $row = $this->m_db->selectRow( 'smw_ids', 'smw_id', $condition, __METHOD__); |
46 | 46 | |
| 47 | + $this->checkForSizeLimit(); |
47 | 48 | if ( $row !== false ) { |
48 | 49 | $this->m_data[$hashKey] = $row->smw_id; |
49 | 50 | return $row->smw_id; |
— | — | @@ -64,6 +65,7 @@ |
65 | 66 | |
66 | 67 | public function setId( $title, $namespace, $interwiki, $subobject, $id ) { |
67 | 68 | $hashKey = self::getHashKey( $title, $namespace, $interwiki, $subobject ); |
| 69 | + $this->checkForSizeLimit(); |
68 | 70 | $this->m_data[$hashKey] = $id; |
69 | 71 | if ( $interwiki == SMW_SQL2_SMWREDIIW ) { |
70 | 72 | $hashKey = self::getHashKey( $title, $namespace, '', $subobject ); |
— | — | @@ -86,6 +88,12 @@ |
87 | 89 | $this->m_data = array(); |
88 | 90 | } |
89 | 91 | |
| 92 | + protected function checkForSizeLimit() { |
| 93 | + if ( count( $this->m_data ) > 1000 ) { |
| 94 | + $this->clear(); |
| 95 | + } |
| 96 | + } |
| 97 | + |
90 | 98 | protected static function getHashKey( $title, $namespace, $interwiki, $subobject ) { |
91 | 99 | return "$title#$namespace#$interwiki#$subobject"; |
92 | 100 | } |