pyshmht
pyshmht copied to clipboard
not support multi-process share-memory
I have test the code as follow.
- Cacher.py set ht['b']='b' print ht['b'] run "python -i Cacher.py" not close this process
- 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.
sorry about that.
- I forget to use ht.write_back() to update the item.
- 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.
这个扩展只是写着玩玩,我们的项目有多个python进程顺序跑,但是希望在进程之间共享一份数据,需求中暂时没有并发,而且真要写起来貌似也还是挺麻烦的,所以就偷懒了……目前并发读是没问题的,但是如果并发写的话估计是要崩的,慎用……