class ReadOnlyHashDB extends HashDB
{
var $isInitialized = false;
function ReadOnlyHashDB($path)
{
parent::HashDB($path);
}
function insert($key, $val) {
$this->write_error();
}
function update($key, $val) {
$this->write_error();
}
function delete($key) {
$this->write_error();
}
function begin() {
if ($this->isInitialized) return;
parent::begin();
$this->isInitialized = true;
}
function write_wrror() {
die("tried to write ReadOnlyHashDB");
}
}
class Property {
:
:
function instance() {
global $pdb;
return new Property($pdb);
}
function instanceReadOnly() {
global $pdbReadOnly; // = new ReadOnlyHashDB
("metadata/property.hash")
return new Property($pdbReadOnly);
}
一度読み込むだけのRead Onlyインターフェースも必要。