yakc API Reference

class yakc.KyotoDB(path[, mode, type, pickle])
Parameters:
  • path – a path of kyoto cabinet database
  • mode – open mode
  • type – a type of database. One of "PolyDB", "TreeDB", "HashDB", "DirDB", "ForestDB". The default type is "PolyDB"
  • pickle – If True, use pickle to store data into database. If False, only string type will be accepted. The default value is True.

If you want to manipulate Kyoto Cabinet database with other tools such as kchashmgr or other bindings, please set pickle=False.

If you select PolyDB as a database type, the path of database should ends with one of .kch, .kct, .kcd, .kcf. Actual database type will be selected by the suffix of the path. Please read PolyDB open reference to learn details.

len(d)

Return the number of items in the database.

d[key]

Return the item of d with key key. Raises a KeyError if key is not in the database.

key in d

Return True if d has a key key, else False. This is a shortcut for has_key().

iter(d)

Return an iterator over the keys of the database. This is a shortcut for iterkeys().

yakc.keys()

Return a list of keys.

yakc.items()

Return a list of items.

yakc.values()

Return a list of values.

yakc.iterkeys()

Return an iterator over the keys of the database.

yakc.iteritems()

Return an iterator over the items of the database.

yakc.itervalues()

Return an iterator over the values of the database.

yakc.get(key[, default])

Return a value if key is exists, else return default. If default is not given, and key is not exists, this method raises KeyError.

yakc.has_key(key)

Return True if the database has a key, else False

yakc.clear()

Remove all items from the dictionary.

yakc.size()

Return the number of items in the database.

yakc.path()

Return the path of the database.

yakc.pop(key[, default])

If key is in the database, remove it and return its value, else return default. If default is not given and key is not in dictionary, a KeyError is raised.

yakc.update([other])

Update the database with the key/value pairs from other. Please refer the description at Python dict.