Posts

Showing posts from November, 2013

Push Notifications

Image
A notification in a message you can display to the user outside of your application's normal UI. When you tell the system to issue a notification, it first appears as an icon in the  notification area . To see the details of the notification, the user opens the  notification drawer . Both the notification area and the notification drawer are system-controlled areas that the user can view at any time. System will also display the notification as a TOAST when user is logged-in along with increment in the notification drawer. Lightweight Event Driven Notification System 1.1      Event Generation The event generation phase happens while processing the response to a user request. As such, we wanted to ensure that there was little or no impact on the response times from where notification is called/generated. To ensure this was the case, all we will do is store the minimum amount of data possible/lightweight message on the queue. We store the min...

Creating your Cache with LRU Algorithm

The LRU caching scheme is to remove the least recently used frame when the cache is full and a new page is referenced which is not there in cache. Please see the Galvin book for more details. This class defines a simple cache entry for the cache. A cache entry holds cached object along with some metadata attributes. These metadata attributes assist in managing the cache. These cache entries are not serializable and thus these are not  cluster aware. This is a simple hash map based cache with LRU cleanup algorithm. CacheEntry.java package com.dapinder.example.own.cache; public class CacheEntry { //the object that is saved in this cache entry private K cachedObject; //the time when the cached object was accessed or modified last time. private long lastAccessTime; /** * This returns the object stored in a cached entry. * * @return the cachedObject */ public K getCachedObject() { lastAccessTime = System.currentTimeMillis(); return cachedObject; ...