async function zetas() {
	
	try {
    	
        let expiredDate = new Date();
	        expiredDate.setHours(expiredDate.getHours() - zetasCooldown);
		
		/** Get player from cache */
		let zetas = await cache.get('swapi', 'zetas', {updated:{ $gte:expiredDate.getTime() }});

		/** Check if existance and expiration */
		if( !zetas || !zetas[0] ) { 
		
			/** If not found or expired, fetch new from API and save to cache */
			zetas = await swgoh.fetchZetas({});
			
			if( !zetas ) { throw new Error('Error fetching zeta recommendations'); } 
			
			zetas = await cache.put('swapi', 'zetas', {}, zetas);

		} else {		
		    zetas = zetas[0];
		}

		return zetas;
		
	} catch(e) { 
		throw e; 
	}    		

}
/**
 *  Fetch zetas recommendations from cache, and sync if necessary
 * 
 */
Fetch zetas recommendations from cache, and sync if necessary
Fetch zetas recommendations from cache and sync if necessary
async function zetas() {
	try {
        let expiredDate = new Date();
	        expiredDate.setHours(expiredDate.getHours() - zetasCooldown);
		let zetas = await cache.get('swapi', 'zetas', {updated:{ $gte:expiredDate.getTime() }});
		if( !zetas || !zetas[0] ) { 
			zetas = await swgoh.fetchZetas({});
			if( !zetas ) { throw new Error('Error fetching zeta recommendations'); } 
			zetas = await cache.put('swapi', 'zetas', {}, zetas);
		} else {		
		    zetas = zetas[0];
		}
		return zetas;
	} catch(e) { 
		throw e; 
	}    		
}
async function zetas ( ) { try { let expiredDate = new Date ( ) ; expiredDate . setHours ( expiredDate . getHours ( ) - zetasCooldown ) ; let zetas = await cache . get ( 'swapi' , 'zetas' , { updated : { $gte : expiredDate . getTime ( ) } } ) ; if ( ! zetas || ! zetas [ 0 ] ) { zetas = await swgoh . fetchZetas ( { } ) ; if ( ! zetas ) { throw new Error ( 'Error fetching zeta recommendations' ) ; } zetas = await cache . put ( 'swapi' , 'zetas' , { } , zetas ) ; } else { zetas = zetas [ 0 ] ; } return zetas ; } catch ( e ) { throw e ; } }
Fetch zetas recommendations from cache, and sync if necessary
Fetch zetas recommendations from cache and sync if necessary
/** Get player from cache */ /** Check if existance and expiration */ /** If not found or expired, fetch new from API and save to cache */