func fromCache(c *Caller, hctx *HookContext) (*jsonrpc.RPCResponse, error) {
	if c.Cache == nil || !isCacheable(hctx.Query) {
		return nil, nil
	}

	cached := c.Cache.Retrieve(hctx.Query.Method(), hctx.Query.Params())
	if cached == nil {
		return nil, nil
	}

	s, err := json.Marshal(cached)
	if err != nil {
		logger.Log().Errorf("error marshalling cached response")
		return nil, nil
	}

	response := hctx.Query.newResponse()
	err = json.Unmarshal(s, &response)
	if err != nil {
		return nil, nil
	}

	logger.WithFields(logrus.Fields{"method": hctx.Query.Method()}).Debug("cached query")
	return response, nil
}
// fromCache returns cached response or nil in case it's a miss
fromCache returns cached response or nil in case it's a miss
// fromCache returns cached response or nil in case it ' s a miss
func fromCache(c *Caller, hctx *HookContext) (*jsonrpc.RPCResponse, error) {
	if c.Cache == nil || !isCacheable(hctx.Query) {
		return nil, nil
	}
	cached := c.Cache.Retrieve(hctx.Query.Method(), hctx.Query.Params())
	if cached == nil {
		return nil, nil
	}
	s, err := json.Marshal(cached)
	if err != nil {
		logger.Log().Errorf("error marshalling cached response")
		return nil, nil
	}
	response := hctx.Query.newResponse()
	err = json.Unmarshal(s, &response)
	if err != nil {
		return nil, nil
	}
	logger.WithFields(logrus.Fields{"method": hctx.Query.Method()}).Debug("cached query")
	return response, nil
}
func fromCache ( c * Caller , hctx * HookContext ) ( * jsonrpc . RPCResponse , error ) { if c . Cache == nil || ! isCacheable ( hctx . Query ) { return nil , nil } cached := c . Cache . Retrieve ( hctx . Query . Method ( ) , hctx . Query . Params ( ) ) if cached == nil { return nil , nil } s , err := json . Marshal ( cached ) if err != nil { logger . Log ( ) . Errorf ( " " ) return nil , nil } response := hctx . Query . newResponse ( ) err = json . Unmarshal ( s , & response ) if err != nil { return nil , nil } logger . WithFields ( logrus . Fields { " " : hctx . Query . Method ( ) } ) . Debug ( " " ) return response , nil }
fromCache returns cached response or nil in case it's a miss
fromCache returns cached response or nil in case it ' s a miss