Ticket #5229

HashDBの読み込み専用インターフェース
오픈 날짜: 2004-11-24 15:55 마지막 업데이트: 2005-03-31 11:29

Reporter:
소유자:
(None)
Status:
Closed
Component:
(None)
MileStone:
(None)
Priority:
5 - Medium
Severity:
5 - Medium
Resolution:
None
File:
None

Details

HashDBはアクセスごとにファイルを読み直すのが遅い。
一度読み込むだけのRead Onlyインターフェースも必要。

Ticket History (2/2 Histories)

2004-11-30 18:45 Updated by: cake
댓글 올리기
Logged In: YES
user_id=10622

getとreadではかなり紛らわしいですし、
ReadOnly/ReadWriteでインスタンスを分けちゃった方が
すっきりするのではないかと思います。

以下私案です。

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);
}

:
:

}

と定義し、用途に応じて global $property; の代わりに
$property = Property::instance(); あるいは
$property = Property::instanceReadOnly()
の様にして使う。

2005-03-31 11:29 Updated by: cake
  • Ticket Close date is changed to 2005-03-31 11:29
  • Status Update from Open to Closed
댓글 올리기
Logged In: YES
user_id=10622

完了

Attachment File List

No attachments

Edit

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Login