Http://bbs.gameres.com/thread_219653_1_1.html
Package Dbentrust
The package below is primarily a database of processing and memcached storage. It encapsulates the mapping from memcached data to Python objects. Data stored in memcached can be manipulated in a way that manipulates Python objects, as long as memobject objects of the same name are instantiated in different processes, ensuring that the data in the object is consistent. It also contains a way to synchronize the data in this object to the database. There is no need to write an SQL statement here.
Class Dbpool
Database Connection Pool
Initpool
Initializing the database connection pool
Type method
CWD firefly/dbentrust/dbpool.py
Prams Initpool (**KW)
Connection
Get a database connection
Type method
CWD firefly/dbentrust/dbpool.py
Params Connecton (self)
Class Memclient
Memcached Client connection classes, which are assigned different namespaces by prefixing the class.
Connect
Connecting memcached Services
Type method
CWD firefly/dbentrust/memclient.py
Params Connect (urls,hostname)
Producekey (KeyName)
Regenerate key
Type method
CWD firefly/dbentrust/memclient.py
Params Producekey (Self,keyname)
Get
Gets the value corresponding to the key
Type method
CWD firefly/dbentrust/memclient.py
Prams Get (key)
Get_multi
Get the value of multiple keys at once
List of @param keys:list (str) keys
Type method
CWD firefly/dbentrust/memclient.py
Params Get_multi (Key)
Set
Set the value corresponding to key
Type method
CWD firefly/dbentrust/memclient.py
Params Set (KeyName, value)
Set_multi
Modify the values of multiple keys
Type method
CWD firefly/dbentrust/memclient.py
Params Set_multi (mapping)
incr
Self-increment
Type method
CWD firefly/dbentrust/memclient.py
Params incr (key, Delta)
Delete
Delete the specified key
Type method
CWD firefly/dbentrust/memclient.py
Params Delete (key)
Delete_multi
Delete multiple keys at once
Type method
CWD firefly/dbentrust/memclient.py
Params Delete_multi (keys)
Flush_all
Clear all data, use with caution
Type method
CWD firefly/dbentrust/memclient.py
Params Flush_all (self)
Class Memobject
A mapping class that memcached data to Python objects. This class is inherited to enable customization of the memcached data format.
Producekey
Regenerate key
Type method
CWD firefly/dbentrust/memobject.py
Params Producekey (Self,keyname)
Locked
Detects if the object is locked
Type method
CWD firefly/dbentrust/memobject.py
Params Lock (self)
Lock
Lock Object
Type method
CWD firefly/dbentrust/memobject.py
Params Lock (self)
Release
Release lock
Type method
CWD firefly/dbentrust/memobject.py
Params Release (self)
Get
Get Object value
Type method
CWD firefly/dbentrust/memobject.py
Params Get (Key)
Get_multi
Get the value of multiple keys at once
Type method
CWD firefly/dbentrust/memobject.py
Params Get_multi (keys)
Update
Modifying the value of an object
Type method
CWD firefly/dbentrust/memobject.py
Params update (key, values)
Update_multi
Modify the values of multiple objects at the same time
Type method
CWD firefly/dbentrust/memobject.py
Params Update_multi (mapping)
Mdelete
Delete data from Memcache
Type method
CWD firefly/dbentrust/memobject.py
Params Mdelete (self)
incr
Self-increment
Type method
CWD firefly/dbentrust/memobject.py
Params incr (key, Delta)
Insert
Insert Object Record
Type method
CWD firefly/dbentrust/memobject.py
Params Insert ()
Class Mmode
Database to memcached direct mapping class. Can be implemented to delay asynchronous to modify data in the database, reduce the pressure on the database. And there is a custom expiration time, after the expiration of the data in the memcached will be automatically cleaned out. Here for the definition of expiration, this object is accessed in the middle of the interval. This class is implemented by inheriting Memobject
Update
Modify the value of a field
Type method
CWD firefly/dbentrust/mmode.py
Params Update (name, PK, data={})
Update_multi
Modify the values of multiple fields
Type method
CWD firefly/dbentrust/mmode.py
Params Update_multi (mapping)
Get
Type method
CWD firefly/dbentrust/mmode.py
Params get (self, key)
Get_multi
Type method
CWD firefly/dbentrust/mmode.py
Params Get_multi (self, keys)
Delete
Delete object, here just modify state to deleted state
Type method
CWD firefly/dbentrust/mmode.py
Params Delete (self)
Mdelete
Clean up the objects and really clean up the data in the memcached.
Type method
CWD firefly/dbentrust/mmode.py
Params Mdelete (self)
Iseffective
Check that the object is valid
Type method
CWD firefly/dbentrust/mmode.py
Params iseffective (self)
SyncDB
Synchronizing to a database
Type method
CWD firefly/dbentrust/mmode.py
Params SyncDB (self)
Checksync
Detect synchronization
Type method
CWD firefly/dbentrust/mmode.py
Params Checksync (self,timeout=timeout)
Class Mfkmode
FOREIGN Key Management
Class Madmin
Mmode Manager, you can obtain an instance of Mmode based on the primary key. A madmin manager corresponds to a table of the database, inheriting from the Memobject class. It is instantiated in the following way
Ma = madmin ("Tb_user", ' id ', FK = ' group ', incrkey= ' id ')
User2 = Ma.getobj (2)
User2.update (' name ', ' Test ')
Represents the database Tb_user this table, through Ma.getobj (2), you can get the corresponding Mmode object of this record with ID 2. User2.update (' name ', ' test ') modifies the record corresponding to the Name field as ' Test '.
Insert
Writes information to memcached.
Type method
CWD firefly/dbentrust/mmode.py
Params Insert (self)
Load
Reads the data into the database, reading all the data in the corresponding table.
Type method
CWD firefly/dbentrust/mmode.py
Params Load (self)
Madmininfo
Get information about Madmin
Type method
CWD firefly/dbentrust/mmode.py
Params Madmininfo (self)
Mfilter
Find compliant objects (inefficient, deprecated)
Type method
CWD firefly/dbentrust/mmode.py
Params Mfilter (SELF,KW)
Getallpkbyfk
Get a list of primary keys based on foreign keys
Type method
CWD firefly/dbentrust/mmode.py
Params GETALLPKBYFK (SELF,FK)
Getobj
Gets the Mmode object for the corresponding record based on the primary key.
Type method
CWD firefly/dbentrust/mmode.py
Params Getobj (PK)
Getobjdata
Gets the field data for the corresponding record's Mmode object based on the primary key.
Type method
CWD firefly/dbentrust/mmode.py
Params Getobjdata (SELF,PK)
Getobjlist
Gets the list of Mmode objects for the corresponding record based on the primary key list.
Type method
CWD firefly/dbentrust/mmode.py
Params getobjlist (self,pklist)
Deletemode
Deletes the corresponding Mmode information according to the primary key.
Type method
CWD firefly/dbentrust/mmode.py
Params Deletemode (SELF,PK)
Checkall
Detects the synchronization of managed object information to the database. and process the expired objects
Type method
CWD firefly/dbentrust/mmode.py
Check ()
Deleteallfk
Delete all foreign keys
Type method
CWD firefly/dbentrust/mmode.py
Params DELETEALLFK (self)
New
Creates a new object that corresponds to the creation of a new record in the database, but is not synchronized in real time. You need to be able to actually sync to the database after the Checkall executes.
Type method
CWD firefly/dbentrust/mmode.py
Params New (Self,data)
Class Madminmanager
The Madmin object's manager, in effect, manages the records of the tables in the entire library, but the corresponding madmin of the table must be registered here.
Registe
Register the Madmin Manager.
Type method
CWD firefly/dbentrust/madminanager.py
Params Registe (self,admin)
Dropadmin
Canceling the management of Madmin objects
Type method
CWD firefly/dbentrust/madminanager.py
Params Dropadmin (Self,adminname)
Getadmin
Gets the registered Madmin object based on the table name.
Type method
CWD firefly/dbentrust/madminanager.py
Params Getadmin (Self,adminname)
Checkadmins
Synchronize all registered madmin corresponding records into the database.
Type method
CWD firefly/dbentrust/madminanager.py
Params Checkadmins (self)
"Firefly API Documentation"--package Dbentrust