當前位置: 首頁>>代碼示例>>Golang>>正文


Golang cache.Delete函數代碼示例

本文整理匯總了Golang中github.com/toolkits/cache.Delete函數的典型用法代碼示例。如果您正苦於以下問題:Golang Delete函數的具體用法?Golang Delete怎麽用?Golang Delete使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了Delete函數的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: Remove

func (this *Team) Remove() error {
	err := UnlinkByTeamId(this.Id)
	if err != nil {
		return err
	}

	num, err := DeleteTeamById(this.Id)
	if err == nil && num > 0 {
		cache.Delete(fmt.Sprintf("team:id:%s", this.Name))
		cache.Delete(fmt.Sprintf("team:obj:%d", this.Id))
	}

	return err
}
開發者ID:Liuyanglong,項目名稱:uic,代碼行數:14,代碼來源:team.go

示例2: Update

func (this *Team) Update() (int64, error) {
	num, err := orm.NewOrm().Update(this)

	if err == nil && num > 0 {
		cache.Delete(fmt.Sprintf("team:obj:%d", this.Id))
	}

	return num, err
}
開發者ID:Liuyanglong,項目名稱:uic,代碼行數:9,代碼來源:team.go

示例3: UpdateUsers

func (this *Team) UpdateUsers(userIdstr string) error {
	if err := UnlinkByTeamId(this.Id); err != nil {
		return err
	}

	cache.Delete(fmt.Sprintf("t:uids:%d", this.Id))

	return PutUsersInTeam(this.Id, userIdstr)
}
開發者ID:Liuyanglong,項目名稱:uic,代碼行數:9,代碼來源:team.go

示例4: UnlinkByTeamId

func UnlinkByTeamId(id int64) error {
	uids, err := Uids(id)
	if err == nil && len(uids) > 0 {
		for i := 0; i < len(uids); i++ {
			cache.Delete(fmt.Sprintf("u:tids:%d", uids[i]))
		}
	}
	_, err = orm.NewOrm().Raw("DELETE FROM `rel_team_user` WHERE `tid` = ?", id).Exec()
	return err
}
開發者ID:LianjiaTech,項目名稱:UIC,代碼行數:10,代碼來源:team.go

示例5: UpdateAdmins

func (this *Team) UpdateAdmins(userIdstr string) error {
	cache.Delete(fmt.Sprintf("t_admin:uids:%d", this.Id))
	uidArr := strings.Split(userIdstr, ",")
	for _, uidS := range uidArr {
		uId, _ := strconv.ParseInt(uidS, 10, 64)
		FlushTeamidCache(uId)
	}

	return PutAdminInTeam(this.Id, userIdstr)
}
開發者ID:LianjiaTech,項目名稱:UIC,代碼行數:10,代碼來源:team.go

示例6: Remove

func (this *User) Remove() (int64, error) {
	num, err := DeleteUserById(this.Id)
	if err != nil {
		return num, err
	}

	cache.Delete(fmt.Sprintf("user:obj:%d", this.Id))
	cache.Delete(fmt.Sprintf("user:id:%s", this.Name))

	tids, err := Tids(this.Id)
	if err == nil && len(tids) > 0 {
		for i := 0; i < len(tids); i++ {
			cache.Delete(fmt.Sprintf("t:uids:%d", tids[i]))
		}
	}

	UnlinkByUserId(this.Id)

	return num, err
}
開發者ID:LianjiaTech,項目名稱:UIC,代碼行數:20,代碼來源:user.go

示例7: RemoveSessionByUid

func RemoveSessionByUid(uid int64) {
	var ss []Session
	Sessions().Filter("Uid", uid).All(&ss, "Id", "Sig")
	if ss == nil || len(ss) == 0 {
		return
	}

	for _, s := range ss {
		num, err := DeleteSessionById(s.Id)
		if err == nil && num > 0 {
			cache.Delete(fmt.Sprintf("session:obj:%s", s.Sig))
		}
	}
}
開發者ID:hitripod,項目名稱:fe,代碼行數:14,代碼來源:session.go

示例8: UpdateUsers

func (this *Team) UpdateUsers(userIdstr string) error {
	if err := UnlinkByTeamId(this.Id); err != nil {
		return err
	}

	cache.Delete(fmt.Sprintf("t:uids:%d", this.Id))

	uidArr := strings.Split(userIdstr, ",")
	for _, uidS := range uidArr {
		uId, _ := strconv.ParseInt(uidS, 10, 64)
		FlushTeamidCache(uId)
	}

	return PutUsersInTeam(this.Id, userIdstr)
}
開發者ID:LianjiaTech,項目名稱:UIC,代碼行數:15,代碼來源:team.go

示例9: Update

func (this *User) Update() (int64, error) {
	modilist := make(map[string][]string)
	modilist["sn"] = []string{this.Cnname}
	modilist["mobile"] = []string{this.Phone}
	res, err := utils.Ldapmonify("10.10.3.102:389", "DC=lianjia,DC=com", "CN=updateuser,OU=SysUser,DC=lianjia,DC=com", "wqLTYYS8dpeUT26R", "mail", this.Email, modilist)
	if res != true || err != nil {
		fmt.Println("User Update Ldap Error: ", res, err)
		return 0, err
	}
	num, err := orm.NewOrm().Update(this)

	if err == nil && num > 0 {
		cache.Delete(fmt.Sprintf("user:obj:%d", this.Id))
	}

	return num, err
}
開發者ID:LianjiaTech,項目名稱:UIC,代碼行數:17,代碼來源:user.go

示例10: FlushTeamidCache

func FlushTeamidCache(uid int64) {
	key := fmt.Sprintf("u:tids:%d", uid)
	cache.Delete(key)
}
開發者ID:LianjiaTech,項目名稱:UIC,代碼行數:4,代碼來源:user.go

示例11: UpdateAdmins

func (this *Team) UpdateAdmins(userIdstr string) error {
	cache.Delete(fmt.Sprintf("t_admin:uids:%d", this.Id))

	return PutAdminInTeam(this.Id, userIdstr)
}
開發者ID:Liuyanglong,項目名稱:uic,代碼行數:5,代碼來源:team.go

示例12: ClearTeamCacheById

func ClearTeamCacheById(id int64) {
	key := fmt.Sprintf("team:obj:%d", id)
	go cache.Delete(key)
}
開發者ID:LianjiaTech,項目名稱:UIC,代碼行數:4,代碼來源:team.go


注:本文中的github.com/toolkits/cache.Delete函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。