public SET(Key key, BulkString value, Expiration expiration, Condition?condition = null) { this.key = key; this.value = value; this.expiration = expiration; this.condition = condition; }
private static bool Equals(BulkString a, BulkString b) { if (a.IsNull && b.IsNull) { return(true); } if (a.IsNull || b.IsNull) { return(false); } if (a.Length != b.Length) { return(false); } var aBytes = a.ToBytes(); var bBytes = b.ToBytes(); for (var i = 0; i < aBytes.Length; i++) { if (aBytes[i] != bBytes[i]) { return(false); } } return(true); }
public override Equality Visit(BulkString bulkString) => new Equality( @false, @false, @false, @false, another => Equals(another, bulkString) );
public LINSERT(Key key, Where where, BulkString pivot, BulkString element) { this.key = key; this.where = where; this.pivot = pivot; this.element = element; }
public override Response Visit(BulkString bulkString) { if (bulkString.IsNull) { return(Response.OperationNotPerformedDueToCondition); } throw Exception(bulkString); }
protected override string PackageCommand(string commandName, params string[] args) { BulkString[] cmd = new BulkString[args.Length + 1]; cmd[0] = new BulkString(commandName); for (int i = 0; i < args.Length; i++) { cmd[i + 1] = new BulkString(args[i]); } return(RedisArray.Package(cmd)); }
public ZINCRBY(Key key, double increment, BulkString member) { if (double.IsNaN(increment)) { throw new ArgumentException("Must not be NaN", nameof(increment)); } this.key = key; this.increment = increment; this.member = member; }
public HINCRBYFLOAT(Key key, BulkString field, double increment) { if (double.IsInfinity(increment) || double.IsNaN(increment)) { throw new ArgumentException($"Must be regular number, but {increment} found", nameof(increment)); } this.key = key; this.field = field; this.increment = increment; }
public static BulkString[] Request(BulkString name, Key key, long count, BulkStringFactory factory) => count == 1 ? new[] { name, key.ToBulkString(factory) } : new[] { name, key.ToBulkString(factory), factory.Create(count) };
private LexBound(Kind kind, BulkString value) { if (value is null) { throw new ArgumentNullException(nameof(value)); } if (value.IsNull) { throw new ArgumentException("Must not be null bulk string", nameof(value)); } this.kind = kind; this.value = value; }
public override int Visit(BulkString bulkString) { if (bulkString.IsNull) { return(-1); } var bytes = bulkString.ToBytes(); if (bytes.Length == 0) { return(-2); } var hash = (int)bytes[0]; for (var i = 1; i < bytes.Length; i++) { hash = (hash * 31) ^ bytes[i]; } return(hash); }
public SET(Key key, BulkString value) : this(key, value, None.Singleton) { }
public override DataType Visit(BulkString bulkString) => bulkString;
public override double Visit(BulkString bulkString) => bulkString.ToDouble();
public override Array Visit(BulkString bulkString) => throw new ArgumentException("Array expected");
public HINCRBY(Key key, BulkString field, long increment) { this.key = key; this.field = field; this.increment = increment; }
public override IReadOnlyList <T> Visit(BulkString bulkString) { var list = listVisitor.Visit(bulkString); return(Project(list)); }
public ZRANK(Key key, BulkString member) { this.key = key; this.member = member; }
public override string Visit(BulkString bulkString) => bulkString.ToString();
public override T Visit(BulkString bulkString) => throw Exception(bulkString);
public override string Visit(BulkString bulkString) => indentation + "$" + Encoding.UTF8.GetString( bulkString.ToBytes() );
public SETEX(Key key, long seconds, BulkString value) { this.key = key; this.seconds = seconds; this.value = value; }
private static Key Parse(BulkString response) { return(response.IsNull ? null : new Key.BulkString(response)); }
public override long?Visit(BulkString bulkString) => bulkString.IsNull ? default(long?) : throw Exception(bulkString);
public SISMEMBER(Key key, BulkString member) { this.key = key; this.member = member; }
public override IReadOnlyList <DataType> Visit(BulkString bulkString) => throw new ArgumentException("Array expected");
public override bool Visit(BulkString bulkString) => bulkStringEquality(bulkString);
public LSET(Key key, Index index, BulkString element) { this.key = key; this.index = index; this.element = element; }
public override long Visit(BulkString bulkString) => throw new VisitException("Integer expected", bulkString);
public LREM(Key key, Count count, BulkString element) { this.key = key; this.count = count; this.element = element; }