-
Notifications
You must be signed in to change notification settings - Fork 1
/
collection.go
64 lines (51 loc) · 2.02 KB
/
collection.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package gocommend
// redis key set
type collectionSet struct {
collectionPrefix string
scoreRank string
mostLiked string
mostDisliked string
allItem string
allUser string
}
func (this *collectionSet) init(collection string) {
this.collectionPrefix = DB_PREFIX + ":" + collection
this.scoreRank = this.collectionPrefix + ":scoreRank"
this.mostLiked = this.collectionPrefix + ":mostLiked"
this.mostDisliked = this.collectionPrefix + ":mostDisliked"
this.allItem = this.collectionPrefix + ":allItem"
this.allUser = this.collectionPrefix + ":allUser"
}
func (this *collectionSet) userLiked(userId string) string {
return this.collectionPrefix + ":" + "userLiked" + ":" + userId
}
func (this *collectionSet) itemLiked(itemId string) string {
return this.collectionPrefix + ":" + "itemLiked" + ":" + itemId
}
func (this *collectionSet) userDisliked(userId string) string {
return this.collectionPrefix + ":" + "userDisliked" + ":" + userId
}
func (this *collectionSet) itemDisliked(itemId string) string {
return this.collectionPrefix + ":" + "itemDisliked" + ":" + itemId
}
func (this *collectionSet) userSimilarity(userId string) string {
return this.collectionPrefix + ":" + "userSimilarity" + ":" + userId
}
func (this *collectionSet) itemSimilarity(itemId string) string {
return this.collectionPrefix + ":" + "itemSimilarity" + ":" + itemId
}
func (this *collectionSet) userTemp(userId string) string {
return this.collectionPrefix + ":" + "userTemp" + ":" + userId
}
func (this *collectionSet) itemTemp(itemId string) string {
return this.collectionPrefix + ":" + "itemTemp" + ":" + itemId
}
func (this *collectionSet) userTempDiff(userId string) string {
return this.collectionPrefix + ":" + "userTempDiff" + ":" + userId
}
func (this *collectionSet) itemTempDiff(userId string) string {
return this.collectionPrefix + ":" + "itemTempDiff" + ":" + userId
}
func (this *collectionSet) recommendedItem(userId string) string {
return this.collectionPrefix + ":" + "recommendedItem" + ":" + userId
}