// Store method are stores value in the cache with expiration time.
// Parameters:
//   - correlationId     (optional) transaction id to trace execution through call chain.
//   - key               a unique value key.
//   - value             a value to store.
//   - timeout           expiration timeout in milliseconds.
// Returns: error or nil for success
Store method are stores value in the cache with expiration time.
Parameters:
- correlationId     (optional) transaction id to trace execution through call chain.
- key               a unique value key.
- value             a value to store.
- timeout           expiration timeout in milliseconds.
Returns: error or nil for success
// Store method are stores value in the cache with expiration time . // Parameters : // - correlationId ( optional ) transaction id to trace execution through call chain . // - key a unique value key . // - value a value to store . // - timeout expiration timeout in milliseconds . // Returns : error or nil for success
func (c *MemcachedCache) Store(correlationId string, key string, value interface{}, timeout int64) (result interface{}, err error) {
	state, err := c.checkOpened(correlationId)
	if !state {
		return nil, err
	}
	timeoutInSec := int32(timeout) / 1000
	var val []byte
	switch v := value.(type) {
	case []byte:
		val = v
		break
	case string:
		val, err = json.Marshal(v)
		break
	default:
		val, err = json.Marshal(v)
		break
	}
	if err != nil {
		return nil, err
	}
	item := memcache.Item{
		Key:        key,
		Value:      val,
		Expiration: timeoutInSec,
	}
	return value, c.client.Set(&item)
}
func ( c * MemcachedCache ) Store ( correlationId string , key string , value interface { } , timeout int64 ) ( result interface { } , err error ) { state , err := c . checkOpened ( correlationId ) if ! state { return nil , err } timeoutInSec := int32 ( timeout ) / 1000 var val [ ] byte switch v := value . ( type ) { case [ ] byte : val = v break case string : val , err = json . Marshal ( v ) break default : val , err = json . Marshal ( v ) break } if err != nil { return nil , err } item := memcache . Item { Key : key , Value : val , Expiration : timeoutInSec , } return value , c . client . Set ( & item ) }
Store method are stores value in the cache with expiration time.
Store method are stores value in the cache with expiration time .