Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not support multi-process share-memory #2

Open
chinesejie opened this issue Nov 22, 2014 · 2 comments
Open

not support multi-process share-memory #2

chinesejie opened this issue Nov 22, 2014 · 2 comments

Comments

@chinesejie
Copy link

I have test the code as follow.

  1. Cacher.py
    set ht['b']='b'
    print ht['b']
    run "python -i Cacher.py"
    not close this process
  2. Cacher2.py
    just print ht['b'] without setter
    run "python -i Cacher2.py"
    cannot get the value.

As I known, I think shared-memory could be read by two processes. How do you think about it.

@chinesejie
Copy link
Author

sorry about that.

  1. I forget to use ht.write_back() to update the item.
  2. And the code "ht = MemCacher('test.Cacher', 1024, True)" will empty the mmap file. It should change to be "ht = MemCacher('test.Cacher', 1024, False)"
    Anyway, it is a really nice project.

@felix021
Copy link
Owner

这个扩展只是写着玩玩,我们的项目有多个python进程顺序跑,但是希望在进程之间共享一份数据,需求中暂时没有并发,而且真要写起来貌似也还是挺麻烦的,所以就偷懒了……目前并发读是没问题的,但是如果并发写的话估计是要崩的,慎用……

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants