Del 删除帖子缓存
(ctx context.Context, key string)
| 176 | |
| 177 | // Del 删除帖子缓存 |
| 178 | func (c *postCache) Del(ctx context.Context, key string) error { |
| 179 | if key == "" { |
| 180 | return fmt.Errorf("无效的帖子ID: %s", key) |
| 181 | } |
| 182 | |
| 183 | pipe := c.client.Pipeline() |
| 184 | pipe.Del(ctx, c.key(key)) |
| 185 | pipe.Del(ctx, c.emptyKey(key)) |
| 186 | pipe.Del(ctx, c.pubKey(key)) |
| 187 | _, err := pipe.Exec(ctx) |
| 188 | return err |
| 189 | } |
| 190 | |
| 191 | // GetList 获取帖子列表缓存 |
| 192 | func (c *postCache) GetList(ctx context.Context, page int, size int) ([]domain.Post, error) { |