dresende / node-orm2

Object Relational Mapping
http://github.com/dresende/node-orm2
MIT License
3.07k stars 379 forks source link

orm update has cache #626

Closed lonso closed 8 years ago

lonso commented 9 years ago

when i update model, i change data on mysql command line. But i orm2,the data not change need i use orm.singleton.clear(); that data will be change. why?

newradius commented 9 years ago

I had the same problem and I lost like 2 hours so I disabled the cache globally. db.settings.set('instance.cache', false);

dxg commented 9 years ago

The cache isn't really a cache, but a singleton pattern. Did you update the model via ORM calls or SQL?

I too disabled it globally.

newradius commented 9 years ago

I update via ORM calls.

dxg commented 9 years ago

Can you provide a limited code sample? Like the one here.

newradius commented 9 years ago

If i try to update the same object, it only updates 1 time. Let's say I want to update an UserRole I retrieve the user with .get and update it but if I want to update it againt the UserRole doesn't update the 2nd time.

dxg commented 9 years ago

If you provide a code sample or even better, a failing test case, then I may be able to do something with it.

Sebush commented 8 years ago

cache and cluster... how can i purge the "cache" in cluster-express-configuration? my solution at the moment is to disable orm-cache

dxg commented 8 years ago

Orm cache isn't a cache at all, but an identity map. I don't see anything wrong with disabling it.