I’m doing some performance testing and DataMapper’s identity map is getting in my way. How do I flush it?
I’m doing some performance testing and DataMapper’s identity map is getting in my way.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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:
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