<!-- generator=" CodePongo (Base on Kukkaisvoima version 15b3TA)" -->
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
>
<channel><title>CodePongo: dbhash</title><link>http://codepongo.com/blog</link><description></description><pubDate>Fri, 21 Feb 2014 17:30:06 +0200</pubDate><lastBuildDate>Fri, 21 Feb 2014 17:30:06 +0200</lastBuildDate><generator>http://codepongo.com/blog</generator><language>zh-cn</language><item><title>The Cahche module in Planet
</title><link>http://codepongo.com/blog/AjJmi</link><comments>http://codepongo.com/blog/AjJmi#comments</comments><pubDate>Fri, 21 Feb 2014 17:30:06 +0200</pubDate><dc:creator>zuohaitao</dc:creator><category>planet</category><category>dbhash</category><category>python</category><guid isPermaLink="false">http://codepongo.com/blog/AjJmi/</guid><description><![CDATA[ 
 [...]]]></description><content:encoded><![CDATA[
modules


+--------------+       +-----+
|planet.Channel|-+-is--|cache|
+----------+---+  \    +-----+
            \      \         +------+
             \      +-have-+-|dbhash|
              \           /  +------+
                +--------+


dbhash

Planet(http://www.planetplanet.org/) uses the hashdb module to cache the feeded
data.

The dbhash module provides a function to open databases using the BSD db library. 
This module mirrors the interface of the other Python database modules that 
provide access to DBM-style databases. The bsddb module is required to use dbhash.


"""output the hashdb"""
import sys
import dbhash
db = dbhash.open(sys.argv[1], 'r')
print db.first()
for i in xrange(1, len(db)):
    print db.next()
db.close()


The dbm library was a simple database engine, originally written by Ken Thompson 
and released by AT&amp;T in 1979. The name is a three letter acronym for database 
manager, and can also refer to the family of database engines with APIs and 
features derived from the original dbm.

planet.Channel and cache modules

the module description is very clear and easy to know, so you can use 
help() to
show the module description and read it.

database file

the database is key/value database
* " keys" is the key of the root item. 


the root item's value is the keys of the channel properties that is splited 
by blank space. 
the key in that there is not blank space is the key of the news item. 
the news item's value is the keys of the news properties that is splited 
by blank space.
the news property's key is the unit of the news item's key and the part of the
news item's value.
the channel property item and the news property item the key of that includes
the string " type" is provided the type of the news property's value.


For example:
the RSS:





CodePongo: json
Thu, 22 Aug 2013 18:16:02 +0200

cJSON source analysis 





the database:


(' keys', 'lastbuilddate title')
('lastbuilddate type', 'string')
('lastbuilddate', 'Thu, 22 Aug 2013 18:16:02 +0200')
('title type', 'string')
('title', 'CodePongo: json')
('http://codepongo.com/blog/3uhyc1/ title type', 'string')
('http://codepongo.com/blog/3uhyc1/ title', 'cJSON source analysis')
('http://codepongo.com/blog/3uhyc1/', 'title')


reference

planet home page

planet introduction

dbhash module
database

]]></content:encoded><wfw:commentRss>http://codepongo.com/blog/AjJmi/feed/</wfw:commentRss></item></channel></rss>