Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
KenyonY committed Jan 12, 2024
1 parent 5bfa837 commit 1f92cd1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,16 @@ pip install flaxkv
### Usage

```python
from flaxkv import dictdb
from flaxkv import FlaxKV
import numpy as np

db = dictdb('test_db')
db = FlaxKV('test_db')
"""
Or start as a server
>>> flaxkv run --port 8000
Client call:
db = dictdb('test_db', root_path_or_url='http://localhost:8000')
db = FlaxKV('test_db', root_path_or_url='http://localhost:8000')
"""

db[1] = 1
Expand Down Expand Up @@ -109,8 +109,6 @@ print(len(db))
### Tips
- `flaxkv` provides performance close to native dictionary (in-memory) access as a persistent database! (See benchmark below)
- You may have noticed that in the previous example code, `db.close()` was not used to release resources! Because all this will be automatically handled by `flaxkv`. Of course, you can also manually call db.close() to immediately release resources.
- Since `flaxkv` saves data by buffered writing, this feature of delayed writing may not write data to the disk in time in some scenarios (such as in Jupyter),
in this case, you can use `db.write_immediately()` to immediately trigger a write operation.

### Benchmark
![benchmark](.github/img/benchmark.png)
Expand Down
8 changes: 3 additions & 5 deletions README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,17 @@ pip install flaxkv
### 使用

```python
from flaxkv import dictdb
from flaxkv import FlaxKV
import numpy as np

db = dictdb('test_db')
db = FlaxKV('test_db')

"""
或者作为服务端启动
>>> flaxkv run --port 8000
客户端调用:
db = dictdb('test_db', root_path_or_url='http://localhost:8000')
db = FlaxKV('test_db', root_path_or_url='http://localhost:8000')
"""

db[1] = 1
Expand Down Expand Up @@ -115,8 +115,6 @@ print(len(db))

- `flaxkv`作为持久化数据库提供了接近原生字典(内存)存取的性能!(见下文benchmark)
- 也许你注意到在前面的示例代码中并没有使用到`db.close()`来进行资源释放!因为这一切都将被`flaxkv`自动处理。 当然也可以手动调用 `db.close()` 来立即释放资源
- 由于`flaxkv`通过缓冲写入的方式来保存数据,这种延迟写入的特性在一些场景(如jupyter中)下将不能及时将数据写入磁盘,
此时可使用`db.write_immediately()`来立即触发写入操作。

### Benchmark
![benchmark](.github/img/benchmark.png)
Expand Down

0 comments on commit 1f92cd1

Please sign in to comment.