Skip to content

Add example to docs of using memory-mapping #1245

Open
@jakirkham

Description

@jakirkham

One can create a memory-mapped store by creating a subclass like this. We may want to add this to the docs. We may also want to graduate _fromfile to fromfile

class MemoryMappedDirectoryStore(DirectoryStore):
    def _fromfile(self, fn):
        with open(fn, "rb") as fh:
            return memoryview(mmap.mmap(fh.fileno(), 0, prot=mmap.PROT_READ))

xref: #377 (comment)
xref: #377 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements to the documentationgood-first-issueGood place to get started as a new contributor.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions