Issue with DBMBackend

Issue #88 closed
wong2 NA
created an issue

Hi, this is my config:

from dogpile.cache import make_region

cache_config = {
    'backend': 'dogpile.cache.dbm',
    'arguments': {
        'filename': 'offline_data/bus_offline_data.dbm'
    }
}

cache = make_region().configure(**cache_config)

the problem is, if I transfer the cache file bus_offline_data.dbm to another machine ( Mac to Windows ), and run the same code, I got this error:

QQ20151103-1.png

so, isn't the cache file portable? and if not, is there a backend to provide portable file cache?

thanks

Comments (2)

  1. jvanasco

    The implementation of "DBM" is actually guaranteed not to work across machines or operating systems. @Michael Bayer implemented the "dbm" backend as a front to 2.x's anydbm which is also 3.x's dbm. That core python module tries to use the best possible "dbm" available on the current machine. There is currently no way to specify which DBM variant to implement, and even if that were possible -- you would run into issues of certain options not being available on certain operating systems.

    If you want something portable, use sqlite or create a script to store "primed" data in a simple format and load it into the cache.

    Since this is a cache file, you shouldn't require this or expect it to be portable.

  2. Log in to comment