listx.go 802 B

1234567891011121314151617181920212223242526272829
  1. package redisx
  2. import "context"
  3. // 列表封装
  4. func LLen(ctx context.Context, key string) (int64, error) {
  5. return getClient().LLen(ctx, key).Result()
  6. }
  7. func LRange(ctx context.Context, key string, start, stop int64) ([]string, error) {
  8. return getClient().LRange(ctx, key, start, stop).Result()
  9. }
  10. func LPush(ctx context.Context, key string, values ...interface{}) error {
  11. return getClient().LPush(ctx, key, values...).Err()
  12. }
  13. func RPush(ctx context.Context, key string, values ...interface{}) error {
  14. return getClient().RPush(ctx, key, values...).Err()
  15. }
  16. func LPop(ctx context.Context, key string) (string, error) {
  17. return getClient().LPop(ctx, key).Result()
  18. }
  19. func LTrim(ctx context.Context, key string, start, stop int64) error {
  20. return getClient().LTrim(ctx, key, start, stop).Err()
  21. }