I'm doing some performance testing and DataMap开发者_开发问答per's identity map is getting in my way. How do I flush it?
In DataMapper the Identity Map is only in effect within the scope of a repository block. Inside the scope of that block you can do:
model.repository.identity_map(model).clear
The IM is keyed by the model, so there's no way to find all the IM's for all the models in one call; you essentially would have to iterate through each model's IM and clear them one at a time.
Keep in mind this isn't part of the documented API, so may be subject to change in future versions of DM. However (speaking as the DataMapper maintainer) it's unlikely to change in the 1.x series, but most likely will change for 2.x
精彩评论