Git Product home page Git Product logo

Comments (7)

PierXuY avatar PierXuY commented on August 18, 2024 2

明白了,谢谢! 那在jupyter里手动执行下db.write_immediately()也是合理的,或许在README里可以说明下。

from flaxkv.

KenyonY avatar KenyonY commented on August 18, 2024

确实如此,当写入的数据大小没有达到db.MAX_BUFFER_SIZE时,数据依旧在内存中的,因此如果期望jupyter 中(或在python进程没有结束之前) 即时写入磁盘,比较方便的方式是手动触发.write_immediately()方法:

db = dictdb('./test_db')
db[(1, 2, 3)] = [1, 2, 3]

db.write_immediately()

也可以通过设置db.MAX_BUFFER_SIZE=1 对每一次数据更新都进行磁盘写入(写入性能很高,不必过于担心);
或是通过设置自动保存的时间间隔db._COMMIT_TIME_INTERVAL(单位:秒)对内存中的缓存数据进行定期磁盘写入。

from flaxkv.

PierXuY avatar PierXuY commented on August 18, 2024

但是在.py文件中执行相同的程序时,就没有这个问题,写入的数据大小是一样的。 是不是还存在别的原因?

from flaxkv.

PierXuY avatar PierXuY commented on August 18, 2024

是会在py文件执行完毕,退出程序前执行写出操作吗? 而jupyter文件没有这一过程

from flaxkv.

KenyonY avatar KenyonY commented on August 18, 2024

是会在py文件执行完毕,退出程序前执行写出操作吗? 而jupyter文件没有这一过程

没错

from flaxkv.

github-actions avatar github-actions commented on August 18, 2024

This issue is stale because it has been open for 30 days with no activity.

from flaxkv.

KenyonY avatar KenyonY commented on August 18, 2024

在版本v0.2.3之后加入了写入监控,即在触发更新数据的相关操作后都会尽快写入,这意味着即使在jupyter中也不必再手动执行db.write_immediately()了。

from flaxkv.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.