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.
18 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 * @version $Id: Cache.php 16971 2009-07-22 18:05:45Z mikaelkael $
23 /** Zend_Server_Cache */
24 require_once 'Zend/Server/Cache.php';
27 * Zend_Json_Server_Cache: cache Zend_Json_Server server definition and SMD
32 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
35 class Zend_Json_Server_Cache
extends Zend_Server_Cache
38 * Cache a service map description (SMD) to a file
40 * Returns true on success, false on failure
42 * @param string $filename
43 * @param Zend_Json_Server $server
46 public static function saveSmd($filename, Zend_Json_Server
$server)
48 if (!is_string($filename)
49 ||
(!file_exists($filename) && !is_writable(dirname($filename))))
54 if (0 === @file_put_contents
($filename, $server->getServiceMap()->toJson())) {
62 * Retrieve a cached SMD
64 * On success, returns the cached SMD (a JSON string); an failure, returns
67 * @param string $filename
68 * @return string|false
70 public static function getSmd($filename)
72 if (!is_string($filename)
73 ||
!file_exists($filename)
74 ||
!is_readable($filename))
80 if (false === ($smd = @file_get_contents
($filename))) {
88 * Delete a file containing a cached SMD
90 * @param string $filename
93 public static function deleteSmd($filename)
95 if (is_string($filename) && file_exists($filename)) {