//Unset removes a key value pair from the cache.
Unset removes a key value pair from the cache.
// Unset removes a key value pair from the cache .
func (c *CacheService) Unset(ctx context.Context, req *cache.UnsetRequest) (*cache.UnsetResponse, error) {
	c.mutex.Lock()
	defer c.mutex.Unlock()
	_, ok := c.store[req.Key]
	if !ok {
		log.Printf("key \"%s\"does not exists\n", req.Key)
		return &cache.UnsetResponse{Ok: false}, status.Errorf(codes.NotFound, "key \"%s\"does not exists", req.Key)
	}
	log.Printf("deleting key \"%s\"\n", req.Key)
	delete(c.store, req.Key)
	return &cache.UnsetResponse{Ok: true}, nil
}
func ( c * CacheService ) Unset ( ctx context . Context , req * cache . UnsetRequest ) ( * cache . UnsetResponse , error ) { c . mutex . Lock ( ) defer c . mutex . Unlock ( ) _ , ok := c . store [ req . Key ] if ! ok { log . Printf ( " \" \" \n " , req . Key ) return & cache . UnsetResponse { Ok : false } , status . Errorf ( codes . NotFound , " \" \" " , req . Key ) } log . Printf ( " \" \" \n " , req . Key ) delete ( c . store , req . Key ) return & cache . UnsetResponse { Ok : true } , nil }
Unset removes a key value pair from the cache.
Unset removes a key value pair from the cache .