public class

DefaultCacheEntry

extends CacheEntry
java.lang.Object
   ↳ com.neomades.content.cache.CacheEntry
     ↳ com.neomades.content.cache.DefaultCacheEntry

Class Overview

Data and metadata for an entry returned by the cache.
DefaultCacheEntry enables the cache data to be refreshed only if a network connection is available. If not, the cache data will be returned. It allows to implement simple cache to handle the offline mode of an application.

To use this class, the NETWORK_STATE permission must be declared in the URS file.

To work with more complicated cases where the cache must be updated according to the data on the server, refer to CacheEntry.

Summary

Public Constructors
DefaultCacheEntry()
Creates a DefaultCacheEntry.
Public Methods
boolean isExpired()
Always false in this implementation, the cache updates will be based only on refreshNeeded().
boolean refreshNeeded()
Returns true if a network is connected.
[Expand]
Inherited Methods
From class com.neomades.content.cache.CacheEntry
From class java.lang.Object

Public Constructors

public DefaultCacheEntry ()

Creates a DefaultCacheEntry.

Public Methods

public boolean isExpired ()

Always false in this implementation, the cache updates will be based only on refreshNeeded().

Returns
  • false

public boolean refreshNeeded ()

Returns true if a network is connected. If not, the request will responds with the data in cache and no network connection will be done.
However, if there are no data in cache, the request will try to connect and an error will be sent.

Returns
  • true if a network is connected