Sqlite.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Cache
  17. * @subpackage Zend_Cache_Backend
  18. * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. */
  21. /**
  22. * @see Zend_Cache_Backend_Interface
  23. */
  24. require_once 'Zend/Cache/Backend/ExtendedInterface.php';
  25. /**
  26. * @see Zend_Cache_Backend
  27. */
  28. require_once 'Zend/Cache/Backend.php';
  29. /**
  30. * @package Zend_Cache
  31. * @subpackage Zend_Cache_Backend
  32. * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
  33. * @license http://framework.zend.com/license/new-bsd New BSD License
  34. */
  35. class Zend_Cache_Backend_Sqlite extends Zend_Cache_Backend implements Zend_Cache_Backend_ExtendedInterface
  36. {
  37. /**
  38. * Available options
  39. *
  40. * =====> (string) cache_db_complete_path :
  41. * - the complete path (filename included) of the SQLITE database
  42. *
  43. * ====> (int) automatic_vacuum_factor :
  44. * - Disable / Tune the automatic vacuum process
  45. * - The automatic vacuum process defragment the database file (and make it smaller)
  46. * when a clean() or delete() is called
  47. * 0 => no automatic vacuum
  48. * 1 => systematic vacuum (when delete() or clean() methods are called)
  49. * x (integer) > 1 => automatic vacuum randomly 1 times on x clean() or delete()
  50. *
  51. * @var array Available options
  52. */
  53. protected $_options = array(
  54. 'cache_db_complete_path' => null,
  55. 'automatic_vacuum_factor' => 10
  56. );
  57. /**
  58. * DB ressource
  59. *
  60. * @var mixed $_db
  61. */
  62. private $_db = null;
  63. /**
  64. * Boolean to store if the structure has benn checked or not
  65. *
  66. * @var boolean $_structureChecked
  67. */
  68. private $_structureChecked = false;
  69. /**
  70. * Constructor
  71. *
  72. * @param array $options Associative array of options
  73. * @throws Zend_cache_Exception
  74. * @return void
  75. */
  76. public function __construct(array $options = array())
  77. {
  78. parent::__construct($options);
  79. if ($this->_options['cache_db_complete_path'] === null) {
  80. Zend_Cache::throwException('cache_db_complete_path option has to set');
  81. }
  82. if (!extension_loaded('sqlite')) {
  83. Zend_Cache::throwException("Cannot use SQLite storage because the 'sqlite' extension is not loaded in the current PHP environment");
  84. }
  85. $this->_getConnection();
  86. }
  87. /**
  88. * Destructor
  89. *
  90. * @return void
  91. */
  92. public function __destruct()
  93. {
  94. @sqlite_close($this->_getConnection());
  95. }
  96. /**
  97. * Test if a cache is available for the given id and (if yes) return it (false else)
  98. *
  99. * @param string $id Cache id
  100. * @param boolean $doNotTestCacheValidity If set to true, the cache validity won't be tested
  101. * @return string|false Cached datas
  102. */
  103. public function load($id, $doNotTestCacheValidity = false)
  104. {
  105. $this->_checkAndBuildStructure();
  106. $sql = "SELECT content FROM cache WHERE id='$id'";
  107. if (!$doNotTestCacheValidity) {
  108. $sql = $sql . " AND (expire=0 OR expire>" . time() . ')';
  109. }
  110. $result = $this->_query($sql);
  111. $row = @sqlite_fetch_array($result);
  112. if ($row) {
  113. return $row['content'];
  114. }
  115. return false;
  116. }
  117. /**
  118. * Test if a cache is available or not (for the given id)
  119. *
  120. * @param string $id Cache id
  121. * @return mixed|false (a cache is not available) or "last modified" timestamp (int) of the available cache record
  122. */
  123. public function test($id)
  124. {
  125. $this->_checkAndBuildStructure();
  126. $sql = "SELECT lastModified FROM cache WHERE id='$id' AND (expire=0 OR expire>" . time() . ')';
  127. $result = $this->_query($sql);
  128. $row = @sqlite_fetch_array($result);
  129. if ($row) {
  130. return ((int) $row['lastModified']);
  131. }
  132. return false;
  133. }
  134. /**
  135. * Save some string datas into a cache record
  136. *
  137. * Note : $data is always "string" (serialization is done by the
  138. * core not by the backend)
  139. *
  140. * @param string $data Datas to cache
  141. * @param string $id Cache id
  142. * @param array $tags Array of strings, the cache record will be tagged by each string entry
  143. * @param int $specificLifetime If != false, set a specific lifetime for this cache record (null => infinite lifetime)
  144. * @throws Zend_Cache_Exception
  145. * @return boolean True if no problem
  146. */
  147. public function save($data, $id, $tags = array(), $specificLifetime = false)
  148. {
  149. $this->_checkAndBuildStructure();
  150. $lifetime = $this->getLifetime($specificLifetime);
  151. $data = @sqlite_escape_string($data);
  152. $mktime = time();
  153. if ($lifetime === null) {
  154. $expire = 0;
  155. } else {
  156. $expire = $mktime + $lifetime;
  157. }
  158. $this->_query("DELETE FROM cache WHERE id='$id'");
  159. $sql = "INSERT INTO cache (id, content, lastModified, expire) VALUES ('$id', '$data', $mktime, $expire)";
  160. $res = $this->_query($sql);
  161. if (!$res) {
  162. $this->_log("Zend_Cache_Backend_Sqlite::save() : impossible to store the cache id=$id");
  163. return false;
  164. }
  165. $res = true;
  166. foreach ($tags as $tag) {
  167. $res = $res && $this->_registerTag($id, $tag);
  168. }
  169. return $res;
  170. }
  171. /**
  172. * Remove a cache record
  173. *
  174. * @param string $id Cache id
  175. * @return boolean True if no problem
  176. */
  177. public function remove($id)
  178. {
  179. $this->_checkAndBuildStructure();
  180. $res = $this->_query("SELECT COUNT(*) AS nbr FROM cache WHERE id='$id'");
  181. $result1 = @sqlite_fetch_single($res);
  182. $result2 = $this->_query("DELETE FROM cache WHERE id='$id'");
  183. $result3 = $this->_query("DELETE FROM tag WHERE id='$id'");
  184. $this->_automaticVacuum();
  185. return ($result1 && $result2 && $result3);
  186. }
  187. /**
  188. * Clean some cache records
  189. *
  190. * Available modes are :
  191. * Zend_Cache::CLEANING_MODE_ALL (default) => remove all cache entries ($tags is not used)
  192. * Zend_Cache::CLEANING_MODE_OLD => remove too old cache entries ($tags is not used)
  193. * Zend_Cache::CLEANING_MODE_MATCHING_TAG => remove cache entries matching all given tags
  194. * ($tags can be an array of strings or a single string)
  195. * Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG => remove cache entries not {matching one of the given tags}
  196. * ($tags can be an array of strings or a single string)
  197. * Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG => remove cache entries matching any given tags
  198. * ($tags can be an array of strings or a single string)
  199. *
  200. * @param string $mode Clean mode
  201. * @param array $tags Array of tags
  202. * @return boolean True if no problem
  203. */
  204. public function clean($mode = Zend_Cache::CLEANING_MODE_ALL, $tags = array())
  205. {
  206. $this->_checkAndBuildStructure();
  207. $return = $this->_clean($mode, $tags);
  208. $this->_automaticVacuum();
  209. return $return;
  210. }
  211. /**
  212. * Return an array of stored cache ids
  213. *
  214. * @return array array of stored cache ids (string)
  215. */
  216. public function getIds()
  217. {
  218. $this->_checkAndBuildStructure();
  219. $res = $this->_query("SELECT id FROM cache WHERE (expire=0 OR expire>" . time() . ")");
  220. $result = array();
  221. while ($id = @sqlite_fetch_single($res)) {
  222. $result[] = $id;
  223. }
  224. return $result;
  225. }
  226. /**
  227. * Return an array of stored tags
  228. *
  229. * @return array array of stored tags (string)
  230. */
  231. public function getTags()
  232. {
  233. $this->_checkAndBuildStructure();
  234. $res = $this->_query("SELECT DISTINCT(name) AS name FROM tag");
  235. $result = array();
  236. while ($id = @sqlite_fetch_single($res)) {
  237. $result[] = $id;
  238. }
  239. return $result;
  240. }
  241. /**
  242. * Return an array of stored cache ids which match given tags
  243. *
  244. * In case of multiple tags, a logical AND is made between tags
  245. *
  246. * @param array $tags array of tags
  247. * @return array array of matching cache ids (string)
  248. */
  249. public function getIdsMatchingTags($tags = array())
  250. {
  251. $first = true;
  252. $ids = array();
  253. foreach ($tags as $tag) {
  254. $res = $this->_query("SELECT DISTINCT(id) AS id FROM tag WHERE name='$tag'");
  255. if (!$res) {
  256. return array();
  257. }
  258. $rows = @sqlite_fetch_all($res, SQLITE_ASSOC);
  259. $ids2 = array();
  260. foreach ($rows as $row) {
  261. $ids2[] = $row['id'];
  262. }
  263. if ($first) {
  264. $ids = $ids2;
  265. $first = false;
  266. } else {
  267. $ids = array_intersect($ids, $ids2);
  268. }
  269. }
  270. $result = array();
  271. foreach ($ids as $id) {
  272. $result[] = $id;
  273. }
  274. return $result;
  275. }
  276. /**
  277. * Return an array of stored cache ids which don't match given tags
  278. *
  279. * In case of multiple tags, a logical OR is made between tags
  280. *
  281. * @param array $tags array of tags
  282. * @return array array of not matching cache ids (string)
  283. */
  284. public function getIdsNotMatchingTags($tags = array())
  285. {
  286. $res = $this->_query("SELECT id FROM cache");
  287. $rows = @sqlite_fetch_all($res, SQLITE_ASSOC);
  288. $result = array();
  289. foreach ($rows as $row) {
  290. $id = $row['id'];
  291. $matching = false;
  292. foreach ($tags as $tag) {
  293. $res = $this->_query("SELECT COUNT(*) AS nbr FROM tag WHERE name='$tag' AND id='$id'");
  294. if (!$res) {
  295. return array();
  296. }
  297. $nbr = (int) @sqlite_fetch_single($res);
  298. if ($nbr > 0) {
  299. $matching = true;
  300. }
  301. }
  302. if (!$matching) {
  303. $result[] = $id;
  304. }
  305. }
  306. return $result;
  307. }
  308. /**
  309. * Return an array of stored cache ids which match any given tags
  310. *
  311. * In case of multiple tags, a logical AND is made between tags
  312. *
  313. * @param array $tags array of tags
  314. * @return array array of any matching cache ids (string)
  315. */
  316. public function getIdsMatchingAnyTags($tags = array())
  317. {
  318. $first = true;
  319. $ids = array();
  320. foreach ($tags as $tag) {
  321. $res = $this->_query("SELECT DISTINCT(id) AS id FROM tag WHERE name='$tag'");
  322. if (!$res) {
  323. return array();
  324. }
  325. $rows = @sqlite_fetch_all($res, SQLITE_ASSOC);
  326. $ids2 = array();
  327. foreach ($rows as $row) {
  328. $ids2[] = $row['id'];
  329. }
  330. if ($first) {
  331. $ids = $ids2;
  332. $first = false;
  333. } else {
  334. $ids = array_merge($ids, $ids2);
  335. }
  336. }
  337. $result = array();
  338. foreach ($ids as $id) {
  339. $result[] = $id;
  340. }
  341. return $result;
  342. }
  343. /**
  344. * Return the filling percentage of the backend storage
  345. *
  346. * @throws Zend_Cache_Exception
  347. * @return int integer between 0 and 100
  348. */
  349. public function getFillingPercentage()
  350. {
  351. $dir = dirname($this->_options['cache_db_complete_path']);
  352. $free = disk_free_space($dir);
  353. $total = disk_total_space($dir);
  354. if ($total == 0) {
  355. Zend_Cache::throwException('can\'t get disk_total_space');
  356. } else {
  357. if ($free >= $total) {
  358. return 100;
  359. }
  360. return ((int) (100. * ($total - $free) / $total));
  361. }
  362. }
  363. /**
  364. * Return an array of metadatas for the given cache id
  365. *
  366. * The array must include these keys :
  367. * - expire : the expire timestamp
  368. * - tags : a string array of tags
  369. * - mtime : timestamp of last modification time
  370. *
  371. * @param string $id cache id
  372. * @return array array of metadatas (false if the cache id is not found)
  373. */
  374. public function getMetadatas($id)
  375. {
  376. $tags = array();
  377. $res = $this->_query("SELECT name FROM tag WHERE id='$id'");
  378. if ($res) {
  379. $rows = @sqlite_fetch_all($res, SQLITE_ASSOC);
  380. foreach ($rows as $row) {
  381. $tags[] = $row['name'];
  382. }
  383. }
  384. $this->_query('CREATE TABLE cache (id TEXT PRIMARY KEY, content BLOB, lastModified INTEGER, expire INTEGER)');
  385. $res = $this->_query("SELECT lastModified,expire FROM cache WHERE id='$id'");
  386. if (!$res) {
  387. return false;
  388. }
  389. $row = @sqlite_fetch_array($res, SQLITE_ASSOC);
  390. return array(
  391. 'tags' => $tags,
  392. 'mtime' => $row['lastModified'],
  393. 'expire' => $row['expire']
  394. );
  395. }
  396. /**
  397. * Give (if possible) an extra lifetime to the given cache id
  398. *
  399. * @param string $id cache id
  400. * @param int $extraLifetime
  401. * @return boolean true if ok
  402. */
  403. public function touch($id, $extraLifetime)
  404. {
  405. $sql = "SELECT expire FROM cache WHERE id='$id' AND (expire=0 OR expire>" . time() . ')';
  406. $res = $this->_query($sql);
  407. if (!$res) {
  408. return false;
  409. }
  410. $expire = @sqlite_fetch_single($res);
  411. $newExpire = $expire + $extraLifetime;
  412. $res = $this->_query("UPDATE cache SET lastModified=" . time() . ", expire=$newExpire WHERE id='$id'");
  413. if ($res) {
  414. return true;
  415. } else {
  416. return false;
  417. }
  418. }
  419. /**
  420. * Return an associative array of capabilities (booleans) of the backend
  421. *
  422. * The array must include these keys :
  423. * - automatic_cleaning (is automating cleaning necessary)
  424. * - tags (are tags supported)
  425. * - expired_read (is it possible to read expired cache records
  426. * (for doNotTestCacheValidity option for example))
  427. * - priority does the backend deal with priority when saving
  428. * - infinite_lifetime (is infinite lifetime can work with this backend)
  429. * - get_list (is it possible to get the list of cache ids and the complete list of tags)
  430. *
  431. * @return array associative of with capabilities
  432. */
  433. public function getCapabilities()
  434. {
  435. return array(
  436. 'automatic_cleaning' => true,
  437. 'tags' => true,
  438. 'expired_read' => true,
  439. 'priority' => false,
  440. 'infinite_lifetime' => true,
  441. 'get_list' => true
  442. );
  443. }
  444. /**
  445. * PUBLIC METHOD FOR UNIT TESTING ONLY !
  446. *
  447. * Force a cache record to expire
  448. *
  449. * @param string $id Cache id
  450. */
  451. public function ___expire($id)
  452. {
  453. $time = time() - 1;
  454. $this->_query("UPDATE cache SET lastModified=$time, expire=$time WHERE id='$id'");
  455. }
  456. /**
  457. * Return the connection resource
  458. *
  459. * If we are not connected, the connection is made
  460. *
  461. * @throws Zend_Cache_Exception
  462. * @return resource Connection resource
  463. */
  464. private function _getConnection()
  465. {
  466. if (is_resource($this->_db)) {
  467. return $this->_db;
  468. } else {
  469. $this->_db = @sqlite_open($this->_options['cache_db_complete_path']);
  470. if (!(is_resource($this->_db))) {
  471. Zend_Cache::throwException("Impossible to open " . $this->_options['cache_db_complete_path'] . " cache DB file");
  472. }
  473. return $this->_db;
  474. }
  475. }
  476. /**
  477. * Execute an SQL query silently
  478. *
  479. * @param string $query SQL query
  480. * @return mixed|false query results
  481. */
  482. private function _query($query)
  483. {
  484. $db = $this->_getConnection();
  485. if (is_resource($db)) {
  486. $res = @sqlite_query($db, $query);
  487. if ($res === false) {
  488. return false;
  489. } else {
  490. return $res;
  491. }
  492. }
  493. return false;
  494. }
  495. /**
  496. * Deal with the automatic vacuum process
  497. *
  498. * @return void
  499. */
  500. private function _automaticVacuum()
  501. {
  502. if ($this->_options['automatic_vacuum_factor'] > 0) {
  503. $rand = rand(1, $this->_options['automatic_vacuum_factor']);
  504. if ($rand == 1) {
  505. $this->_query('VACUUM');
  506. @sqlite_close($this->_getConnection());
  507. }
  508. }
  509. }
  510. /**
  511. * Register a cache id with the given tag
  512. *
  513. * @param string $id Cache id
  514. * @param string $tag Tag
  515. * @return boolean True if no problem
  516. */
  517. private function _registerTag($id, $tag) {
  518. $res = $this->_query("DELETE FROM TAG WHERE name='$tag' AND id='$id'");
  519. $res = $this->_query("INSERT INTO tag (name, id) VALUES ('$tag', '$id')");
  520. if (!$res) {
  521. $this->_log("Zend_Cache_Backend_Sqlite::_registerTag() : impossible to register tag=$tag on id=$id");
  522. return false;
  523. }
  524. return true;
  525. }
  526. /**
  527. * Build the database structure
  528. *
  529. * @return false
  530. */
  531. private function _buildStructure()
  532. {
  533. $this->_query('DROP INDEX tag_id_index');
  534. $this->_query('DROP INDEX tag_name_index');
  535. $this->_query('DROP INDEX cache_id_expire_index');
  536. $this->_query('DROP TABLE version');
  537. $this->_query('DROP TABLE cache');
  538. $this->_query('DROP TABLE tag');
  539. $this->_query('CREATE TABLE version (num INTEGER PRIMARY KEY)');
  540. $this->_query('CREATE TABLE cache (id TEXT PRIMARY KEY, content BLOB, lastModified INTEGER, expire INTEGER)');
  541. $this->_query('CREATE TABLE tag (name TEXT, id TEXT)');
  542. $this->_query('CREATE INDEX tag_id_index ON tag(id)');
  543. $this->_query('CREATE INDEX tag_name_index ON tag(name)');
  544. $this->_query('CREATE INDEX cache_id_expire_index ON cache(id, expire)');
  545. $this->_query('INSERT INTO version (num) VALUES (1)');
  546. }
  547. /**
  548. * Check if the database structure is ok (with the good version)
  549. *
  550. * @return boolean True if ok
  551. */
  552. private function _checkStructureVersion()
  553. {
  554. $result = $this->_query("SELECT num FROM version");
  555. if (!$result) return false;
  556. $row = @sqlite_fetch_array($result);
  557. if (!$row) {
  558. return false;
  559. }
  560. if (((int) $row['num']) != 1) {
  561. // old cache structure
  562. $this->_log('Zend_Cache_Backend_Sqlite::_checkStructureVersion() : old cache structure version detected => the cache is going to be dropped');
  563. return false;
  564. }
  565. return true;
  566. }
  567. /**
  568. * Clean some cache records
  569. *
  570. * Available modes are :
  571. * Zend_Cache::CLEANING_MODE_ALL (default) => remove all cache entries ($tags is not used)
  572. * Zend_Cache::CLEANING_MODE_OLD => remove too old cache entries ($tags is not used)
  573. * Zend_Cache::CLEANING_MODE_MATCHING_TAG => remove cache entries matching all given tags
  574. * ($tags can be an array of strings or a single string)
  575. * Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG => remove cache entries not {matching one of the given tags}
  576. * ($tags can be an array of strings or a single string)
  577. * Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG => remove cache entries matching any given tags
  578. * ($tags can be an array of strings or a single string)
  579. *
  580. * @param string $mode Clean mode
  581. * @param array $tags Array of tags
  582. * @return boolean True if no problem
  583. */
  584. private function _clean($mode = Zend_Cache::CLEANING_MODE_ALL, $tags = array())
  585. {
  586. switch ($mode) {
  587. case Zend_Cache::CLEANING_MODE_ALL:
  588. $res1 = $this->_query('DELETE FROM cache');
  589. $res2 = $this->_query('DELETE FROM tag');
  590. return $res1 && $res2;
  591. break;
  592. case Zend_Cache::CLEANING_MODE_OLD:
  593. $mktime = time();
  594. $res1 = $this->_query("DELETE FROM tag WHERE id IN (SELECT id FROM cache WHERE expire>0 AND expire<=$mktime)");
  595. $res2 = $this->_query("DELETE FROM cache WHERE expire>0 AND expire<=$mktime");
  596. return $res1 && $res2;
  597. break;
  598. case Zend_Cache::CLEANING_MODE_MATCHING_TAG:
  599. $ids = $this->getIdsMatchingTags($tags);
  600. $result = true;
  601. foreach ($ids as $id) {
  602. $result = $result && ($this->remove($id));
  603. }
  604. return $result;
  605. break;
  606. case Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG:
  607. $ids = $this->getIdsNotMatchingTags($tags);
  608. $result = true;
  609. foreach ($ids as $id) {
  610. $result = $result && ($this->remove($id));
  611. }
  612. return $result;
  613. break;
  614. case Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG:
  615. $ids = $this->getIdsMatchingAnyTags($tags);
  616. $result = true;
  617. foreach ($ids as $id) {
  618. $result = $result && ($this->remove($id));
  619. }
  620. return $result;
  621. break;
  622. default:
  623. break;
  624. }
  625. return false;
  626. }
  627. /**
  628. * Check if the database structure is ok (with the good version), if no : build it
  629. *
  630. * @throws Zend_Cache_Exception
  631. * @return boolean True if ok
  632. */
  633. private function _checkAndBuildStructure()
  634. {
  635. if (!($this->_structureChecked)) {
  636. if (!$this->_checkStructureVersion()) {
  637. $this->_buildStructure();
  638. if (!$this->_checkStructureVersion()) {
  639. Zend_Cache::throwException("Impossible to build cache structure in " . $this->_options['cache_db_complete_path']);
  640. }
  641. }
  642. $this->_structureChecked = true;
  643. }
  644. return true;
  645. }
  646. }