Commit 868c210e authored by Varun Patil's avatar Varun Patil

fix(AddEvent): Invalidate memcache on update (fix #274)

parent 3da30c2a
......@@ -21,4 +21,15 @@ public class UpdatableList<T> extends ArrayList<T> {
}
this.add(t);
}
/** Remove from cache */
public void invalidateCache(T t) {
for (int i = 0; i < this.size(); i++) {
T cachedT = this.get(i);
if (cachedT.equals(t)) {
this.remove(i);
return;
}
}
}
}
......@@ -138,6 +138,7 @@ public class AddEventFragment extends BaseFragment {
}
private void openEvent(Event event) {
Utils.eventCache.updateCache(event);
String eventJson = new Gson().toJson(event);
Bundle bundle = getArguments();
if (bundle == null)
......@@ -153,6 +154,7 @@ public class AddEventFragment extends BaseFragment {
}
private void openBody(Body body) {
Utils.bodyCache.invalidateCache(body);
BodyFragment bodyFragment = BodyFragment.newInstance(body);
FragmentManager manager = getActivity().getSupportFragmentManager();
FragmentTransaction transaction = manager.beginTransaction();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment