https://github.com/jw3126/diskbackeddicts.jl
Simple Dict that is backed on hard disk
https://github.com/jw3126/diskbackeddicts.jl
julia
Last synced: about 1 year ago
JSON representation
Simple Dict that is backed on hard disk
- Host: GitHub
- URL: https://github.com/jw3126/diskbackeddicts.jl
- Owner: jw3126
- License: mit
- Created: 2017-12-13T18:07:57.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-06-03T06:20:40.000Z (about 3 years ago)
- Last Synced: 2025-03-07T15:58:36.857Z (over 1 year ago)
- Topics: julia
- Language: Julia
- Homepage:
- Size: 42 KB
- Stars: 8
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DiskBackedDicts
[](https://travis-ci.org/jw3126/DiskBackedDicts.jl)
[](http://codecov.io/github/jw3126/DiskBackedDicts.jl?branch=master)
## Usage
```julia
julia> using DiskBackedDicts
julia> d = DiskBackedDict("somepath.jld2")
DiskBackedDict{Any,Any} with 0 entries
julia> d["hello"] = "world"
"world"
julia> d
DiskBackedDict{Any,Any} with 1 entry:
"hello" => "world"
julia> exit()
```
Now start a new session:
```julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.0.1 (2018-09-29)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> using DiskBackedDicts
julia> d = DiskBackedDict("somepath.jld2")
DiskBackedDict{Any,Any} with 1 entry:
"hello" => "world"
```
## Performance
The whole dictionary is cached in memory. `getindex` performs no disk operations and is as fast as for an
ordinary `Dict`. `setindex!` performs disk operations and is slow.
## Limitations
* Only one julia process can access a `DiskBackedDict` at a particular path simultaneously.