vadimtsushko / objectory

Unsupported: Objectory - object document mapper for server-side and client side Dart applications
MIT License
55 stars 12 forks source link

The cache is too aggressive #19

Closed kaisellgren closed 11 years ago

kaisellgren commented 11 years ago

I have client-side code that sometimes does the same database query, and now I don't see any chances because it fetches results from the objectory.cache.

Resetting the cache to {} resolves my problem. I simply do the same query more than once.

vadimtsushko commented 11 years ago

Find and findOne now alway get results from Db and never from Cache, Is problem solved?

kaisellgren commented 11 years ago

All else seems to be ok, except that when dart2js'd, this code does not work (I'm not sure when it worked the last time):

objectory.find($TagGroup).then((tagGroups) {
  print(tagGroups.first.tags.first.id);
  print(tagGroups.first.tags.first.title);
});

Prints in dartium:

ObjectId(5165958455dc633b4c000005)
Biotech 

and when dart2js'd in Chrome:

ObjectId(5165958455dc633b4c000005)
null 

Are you able to reproduce this? Do I need to provide more code?

vadimtsushko commented 11 years ago

I believe you have to call fetchLinks() before access any property of linked object (exept for id property) Something like that shoud probably work

objectory.find($TagGroup.fetchLinks()).then((tagGroups) {
  print(tagGroups.first.tags.first.id);
  print(tagGroups.first.tags.first.title);
});
kaisellgren commented 11 years ago

Even with that it doesn't print properly:

platform.objectory.find($TagGroup.fetchLinks()).then((tagGroups) {
  print(tagGroups.first.tags.first.id);
  print(tagGroups.first.tags.first.title);
});

Prints in dartium:

ObjectId(5165958455dc633b4c000005)
Biotech 

and when dart2js'd in Chrome:

ObjectId(5165958455dc633b4c000005)
null 

Remember, it works well on Dartium.

kaisellgren commented 11 years ago

I don't think is related to Objectory.