Adjust the action order in Put function.
This commit is contained in:
		
							parent
							
								
									2933d1fedd
								
							
						
					
					
						commit
						b6c4e27a75
					
				
							
								
								
									
										4
									
								
								cache/redis/redis.go
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								cache/redis/redis.go
									
									
									
									
										vendored
									
									
								
							| @ -57,11 +57,11 @@ func (rc *RedisCache) Get(key string) interface{} { | |||||||
| 
 | 
 | ||||||
| // put cache to redis. | // put cache to redis. | ||||||
| func (rc *RedisCache) Put(key string, val interface{}, timeout int64) error { | func (rc *RedisCache) Put(key string, val interface{}, timeout int64) error { | ||||||
| 	_, err := rc.do("HSET", rc.key, key, true) |         _, err := rc.do("SET", key, val) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return nil | 		return nil | ||||||
| 	} | 	} | ||||||
| 	_, err = rc.do("SET", key, val) | 	_, err = rc.do("HSET", rc.key, key, true) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return nil | 		return nil | ||||||
| 	} | 	} | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user