func (db *Redis) BumpHitCount(id string) error {

	err := db.store.Watch(func(tx *redis.Tx) error {

		linkRaw, err := tx.Get(id).Bytes()
		if err == redis.Nil {
			return tkerrors.ErrEntityNotFound
		}
		if err != nil {
			return err
		}

		var storedLink models.Link
		err = json.Unmarshal(linkRaw, &storedLink)
		if err != nil {
			return err
		}

		storedLink.Hits++

		encodedLink, err := json.Marshal(storedLink)
		if err != nil {
			return err
		}

		err = tx.Set(id, encodedLink, 0).Err()
		if err != nil {
			return err
		}

		return err
	})
	if err != nil {
		return err
	}

	return nil
}
// BumpHitCount updates the hit number on a certain link
BumpHitCount updates the hit number on a certain link
// BumpHitCount updates the hit number on a certain link
func (db *Redis) BumpHitCount(id string) error {
	err := db.store.Watch(func(tx *redis.Tx) error {
		linkRaw, err := tx.Get(id).Bytes()
		if err == redis.Nil {
			return tkerrors.ErrEntityNotFound
		}
		if err != nil {
			return err
		}
		var storedLink models.Link
		err = json.Unmarshal(linkRaw, &storedLink)
		if err != nil {
			return err
		}
		storedLink.Hits++
		encodedLink, err := json.Marshal(storedLink)
		if err != nil {
			return err
		}
		err = tx.Set(id, encodedLink, 0).Err()
		if err != nil {
			return err
		}
		return err
	})
	if err != nil {
		return err
	}
	return nil
}
func ( db * Redis ) BumpHitCount ( id string ) error { err := db . store . Watch ( func ( tx * redis . Tx ) error { linkRaw , err := tx . Get ( id ) . Bytes ( ) if err == redis . Nil { return tkerrors . ErrEntityNotFound } if err != nil { return err } var storedLink models . Link err = json . Unmarshal ( linkRaw , & storedLink ) if err != nil { return err } storedLink . Hits ++ encodedLink , err := json . Marshal ( storedLink ) if err != nil { return err } err = tx . Set ( id , encodedLink , 0 ) . Err ( ) if err != nil { return err } return err } ) if err != nil { return err } return nil }
BumpHitCount updates the hit number on a certain link
BumpHitCount updates the hit number on a certain link