Hi, > Am 25.01.2017 um 01:30 schrieb Alejandro Infante > <alejandroinfant...@gmail.com>: > > Hi! > > I’m close to deploy a web service using Pharo with Voyage and MongoDB. I have > been playing with it and everything works ok with a single Pharo image. > > Couple of days ago I started questioning myself about how voyage behaves when > you have multiple pharo images using the same mongo database (horizontal > scaling). I want to know how the cache of voyage behaves in a scenario with > object updates. > > Example: —————————————— > Imagine I have two images A and B. > > - Image A query for object o and voyage put it in the cache. > - Image B query for object o and voyage put it in the cache. > - Image A updates object o and push it into the database calling #save. > - Image B query for object o that should be already in the cache. > > In this case, does Image B see the changes performed by image A? > —————————————— > > All ideas are welcome :) > the only problems you have with the cache is its name :) It isn't really a cache. If you request an object a query is issued to the database. So your scenario is no problem because in the last step when B queries the object it queries the database, will see that the version number of the objects changed and will update the object in the cache. The sole purpose of the cache is to enable identity of database objects. Nevertheless you can have problems if you use references. Voyage can handle references pretty well. But each class might be stored in another document/collection. As in mongo only the storage of a single document is atomic you need to be careful when doing concurrent updates with references.
Norbert