| Path: | lib/mues/objectstore.rb (CVS) |
| Last Update: | Sat Aug 18 22:54:10 -0700 2007 |
This file contains the MUES::ObjectStore class, which is used to provide object persistance for MUES objects.
The ObjectStore is a factory/wrapper class that provides a front end for combining a Strategy for object persistance (a MUES::ObjectStore::Backend) and, optionally, a one for swapping disused objects (mostly) out of memory temporarily via a MUES::ObjectStore::MemoryManager.
Not yet done.
require 'mues/objectstore'
require 'mues/storableobject'
$store = MUES::ObjectStore::create(
:backend => "BerkeleyDB",
:memmgr => "PMOS",
:name => "mystore"
)
objs = []
ids = []
40.times do
newObj = MUES::StorableObject.new
objs << newObj
ids << newObj.objectStoreId
end
$store.store( *objs )
$store.retrieve_readonly {|obj| puts obj.attr}
object = $store.retrieve( "objid" )
object.attribute_A = 3.14159262546
$store.store( object )
$store.close
$Id: objectstore.rb 1189 2004-05-02 18:39:03Z deveiant $
Copyright (c) 2000-2003 The FaerieMUD Consortium. All rights reserved.
This module is free software. You may use, modify, and/or redistribute this software under the terms of the Perl Artistic License. (See language.perl.com/misc/Artistic.html)
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.