@@ -17,9 +17,12 @@ public function avg($column)
17
17
}
18
18
19
19
return $ this ->cache ($ this ->makeCacheTags ())
20
- ->rememberForever ($ this ->makeCacheKey () . "-avg_ {$ column }" , function () use ($ column ) {
21
- return parent ::avg ($ column );
22
- });
20
+ ->rememberForever (
21
+ $ this ->makeCacheKey (['* ' ], null , "-avg_ {$ column }" ),
22
+ function () use ($ column ) {
23
+ return parent ::avg ($ column );
24
+ }
25
+ );
23
26
}
24
27
25
28
public function count ($ columns = ['* ' ])
@@ -29,9 +32,12 @@ public function count($columns = ['*'])
29
32
}
30
33
31
34
return $ this ->cache ($ this ->makeCacheTags ())
32
- ->rememberForever ($ this ->makeCacheKey () . "-count " , function () use ($ columns ) {
33
- return parent ::count ($ columns );
34
- });
35
+ ->rememberForever (
36
+ $ this ->makeCacheKey (['* ' ], null , "-count " ),
37
+ function () use ($ columns ) {
38
+ return parent ::count ($ columns );
39
+ }
40
+ );
35
41
}
36
42
37
43
public function cursor ()
@@ -41,9 +47,12 @@ public function cursor()
41
47
}
42
48
43
49
return $ this ->cache ($ this ->makeCacheTags ())
44
- ->rememberForever ($ this ->makeCacheKey () . "-cursor " , function () {
45
- return collect (parent ::cursor ());
46
- });
50
+ ->rememberForever (
51
+ $ this ->makeCacheKey (['* ' ], null , "-cursor " ),
52
+ function () {
53
+ return collect (parent ::cursor ());
54
+ }
55
+ );
47
56
}
48
57
49
58
public function delete ()
@@ -64,9 +73,12 @@ public function find($id, $columns = ['*'])
64
73
}
65
74
66
75
return $ this ->cache ($ this ->makeCacheTags ())
67
- ->rememberForever ($ this ->makeCacheKey ($ columns , $ id ), function () use ($ id , $ columns ) {
68
- return parent ::find ($ id , $ columns );
69
- });
76
+ ->rememberForever (
77
+ $ this ->makeCacheKey ($ columns , $ id ),
78
+ function () use ($ id , $ columns ) {
79
+ return parent ::find ($ id , $ columns );
80
+ }
81
+ );
70
82
}
71
83
72
84
public function first ($ columns = ['* ' ])
@@ -76,9 +88,12 @@ public function first($columns = ['*'])
76
88
}
77
89
78
90
return $ this ->cache ($ this ->makeCacheTags ())
79
- ->rememberForever ($ this ->makeCacheKey ($ columns ) . '-first ' , function () use ($ columns ) {
80
- return parent ::first ($ columns );
81
- });
91
+ ->rememberForever (
92
+ $ this ->makeCacheKey ($ columns , null , '-first ' ),
93
+ function () use ($ columns ) {
94
+ return parent ::first ($ columns );
95
+ }
96
+ );
82
97
}
83
98
84
99
public function get ($ columns = ['* ' ])
@@ -88,9 +103,12 @@ public function get($columns = ['*'])
88
103
}
89
104
90
105
return $ this ->cache ($ this ->makeCacheTags ())
91
- ->rememberForever ($ this ->makeCacheKey ($ columns ), function () use ($ columns ) {
92
- return parent ::get ($ columns );
93
- });
106
+ ->rememberForever (
107
+ $ this ->makeCacheKey ($ columns ),
108
+ function () use ($ columns ) {
109
+ return parent ::get ($ columns );
110
+ }
111
+ );
94
112
}
95
113
96
114
public function max ($ column )
@@ -100,9 +118,12 @@ public function max($column)
100
118
}
101
119
102
120
return $ this ->cache ($ this ->makeCacheTags ())
103
- ->rememberForever ($ this ->makeCacheKey () . "-max_ {$ column }" , function () use ($ column ) {
104
- return parent ::max ($ column );
105
- });
121
+ ->rememberForever (
122
+ $ this ->makeCacheKey (['* ' ], null , "-max_ {$ column }" ),
123
+ function () use ($ column ) {
124
+ return parent ::max ($ column );
125
+ }
126
+ );
106
127
}
107
128
108
129
public function min ($ column )
@@ -112,9 +133,12 @@ public function min($column)
112
133
}
113
134
114
135
return $ this ->cache ($ this ->makeCacheTags ())
115
- ->rememberForever ($ this ->makeCacheKey () . "-min_ {$ column }" , function () use ($ column ) {
116
- return parent ::min ($ column );
117
- });
136
+ ->rememberForever (
137
+ $ this ->makeCacheKey (['* ' ], null , "-min_ {$ column }" ),
138
+ function () use ($ column ) {
139
+ return parent ::min ($ column );
140
+ }
141
+ );
118
142
}
119
143
120
144
public function pluck ($ column , $ key = null )
@@ -123,11 +147,8 @@ public function pluck($column, $key = null)
123
147
return parent ::pluck ($ column , $ key );
124
148
}
125
149
126
- $ cacheKey = $ this ->makeCacheKey ([$ column ]) . "-pluck_ {$ column }" ;
127
-
128
- if ($ key ) {
129
- $ cacheKey .= "_ {$ key }" ;
130
- }
150
+ $ keyDifferentiator = "-pluck_ {$ column }" . ($ key ? "_ {$ key }" : "" );
151
+ $ cacheKey = $ this ->makeCacheKey ([$ column ], null , $ keyDifferentiator );
131
152
132
153
return $ this ->cache ($ this ->makeCacheTags ())
133
154
->rememberForever ($ cacheKey , function () use ($ column , $ key ) {
@@ -142,9 +163,12 @@ public function sum($column)
142
163
}
143
164
144
165
return $ this ->cache ($ this ->makeCacheTags ())
145
- ->rememberForever ($ this ->makeCacheKey () . "-sum_ {$ column }" , function () use ($ column ) {
146
- return parent ::sum ($ column );
147
- });
166
+ ->rememberForever (
167
+ $ this ->makeCacheKey (['* ' ], null , "-sum_ {$ column }" ),
168
+ function () use ($ column ) {
169
+ return parent ::sum ($ column );
170
+ }
171
+ );
148
172
}
149
173
150
174
public function value ($ column )
@@ -154,8 +178,11 @@ public function value($column)
154
178
}
155
179
156
180
return $ this ->cache ($ this ->makeCacheTags ())
157
- ->rememberForever ($ this ->makeCacheKey () . "-value_ {$ column }" , function () use ($ column ) {
158
- return parent ::value ($ column );
159
- });
181
+ ->rememberForever (
182
+ $ this ->makeCacheKey (['* ' ], null , "-value_ {$ column }" ),
183
+ function () use ($ column ) {
184
+ return parent ::value ($ column );
185
+ }
186
+ );
160
187
}
161
188
}
0 commit comments