当前位置: 首页>>代码示例>>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;未经允许,请勿转载。