Skip to content

Commit

Permalink
DefaultViewsRepositoryStorage: index by ViewId (not string)
Browse files Browse the repository at this point in the history
  • Loading branch information
teosarca committed Jul 22, 2017
1 parent 18fc3c1 commit 771e5c3
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
// NOTE: don't add it to spring context! i.e. don't annotate it with @Component or similar
/* package */final class DefaultViewsRepositoryStorage implements IViewsIndexStorage
{
private final Cache<String, IView> views = CacheBuilder.newBuilder()
private final Cache<ViewId, IView> views = CacheBuilder.newBuilder()
.expireAfterAccess(1, TimeUnit.HOURS)
.removalListener(notification -> onViewRemoved(notification))
.build();
Expand All @@ -61,19 +61,19 @@ private final void onViewRemoved(final RemovalNotification<Object, Object> notif
@Override
public void put(@NonNull final IView view)
{
views.put(view.getViewId().getViewId(), view);
views.put(view.getViewId(), view);
}

@Override
public IView getByIdOrNull(@NonNull final ViewId viewId)
{
return views.getIfPresent(viewId.getViewId());
return views.getIfPresent(viewId);
}

@Override
public void removeById(@NonNull final ViewId viewId)
{
views.invalidate(viewId.getViewId());
views.invalidate(viewId);
}

@Override
Expand Down

0 comments on commit 771e5c3

Please sign in to comment.