//Get gets a value given the key.
Get gets a value given the key.
// Get gets a value given the key .
func (c *CacheService) Get(ctx context.Context, req *cache.GetRequest) (*cache.GetResponse, error) {
	c.mutex.Lock()
	defer c.mutex.Unlock()
	val, ok := c.store[req.Key]
	if !ok {
		log.Printf("key \"%s\" not found\n", req.Key)
		return nil, status.Errorf(codes.NotFound, "key \"%s\" not found", req.Key)
	}
	log.Printf("retrieving key \"%s\"", req.Key)
	return &cache.GetResponse{Value: val}, nil
}
func ( c * CacheService ) Get ( ctx context . Context , req * cache . GetRequest ) ( * cache . GetResponse , error ) { c . mutex . Lock ( ) defer c . mutex . Unlock ( ) val , ok := c . store [ req . Key ] if ! ok { log . Printf ( " \" \" \n " , req . Key ) return nil , status . Errorf ( codes . NotFound , " \" \" " , req . Key ) } log . Printf ( " \" \" " , req . Key ) return & cache . GetResponse { Value : val } , nil }
Get gets a value given the key.
Get gets a value given the key .