internal static Command CreateLongCommand(string name, Func<FSharpOption<int>, Register, LongCommandResult> func, CommandFlags flags = CommandFlags.None) { var fsharpFunc = FSharpFuncUtil.Create(func); var list = name.Select(InputUtil.CharToKeyInput).ToFSharpList(); var commandName = CommandName.NewManyKeyInputs(list); return Command.NewLongCommand(commandName, flags, fsharpFunc); }
/// <summary> /// Initializes a new instance of the <see cref="Command"/> class. /// </summary> /// <param name="flags">Command flags.</param> /// <param name="name">The command's name.</param> /// <param name="description">The command's description.</param> /// <param name="usage">The command's usage string.</param> /// <param name="helpMessage">The command's help message.</param> protected Command(CommandFlags flags, string name, string description, string usage, string helpMessage) { Name = name; Description = description; Usage = usage; HelpMessage = helpMessage; Flags = flags; }
/// <summary> /// EXISTS http://redis.io/commands/exists /// </summary> public Task<bool> Exists(CommandFlags commandFlags = CommandFlags.None) { return TraceHelper.RecordReceive(Settings, Key, CallType, async () => { var r = await Command.KeyExistsAsync(Key, commandFlags).ForAwait(); return Tracing.CreateReceived(r, sizeof(bool)); }); }
// private Properties.WidgetPropsManager _prop_man; // Constructor is 'protected' protected Common() { _cur_element = null; _cur_window = null; _obj_props_panel = null; _cur_action = CommandFlags.TB_NONE; _obj_tree_il = null; _py_editor = new mkdb.Python.PyFileEditor(); // _prop_man = new mkdb.Properties.WidgetPropsManager(); }
public void Dispose() { if (Disposing != null) Disposing(this); Flags = CommandFlags.None; ValidateHnd = null; PrepareHnd = null; ExecuteHnd = null; FinishHnd = null; }
/// <summary> /// Initialize the command definition /// </summary> public CommandDefinition(string commandText, object parameters = null, IDbTransaction transaction = null, int? commandTimeout = null, CommandType? commandType = null, CommandFlags flags = CommandFlags.Buffered #if ASYNC , CancellationToken cancellationToken = default(CancellationToken) #endif ) { CommandText = commandText; Parameters = parameters; Transaction = transaction; CommandTimeout = commandTimeout; CommandType = commandType; Flags = flags; #if ASYNC CancellationToken = cancellationToken; #endif }
internal static Command CreateLongCommand(string name, Func<KeyInput, bool> func, CommandFlags flags = CommandFlags.None) { return CreateLongCommand( name, (x, y) => { FSharpFunc<KeyInput, LongCommandResult> realFunc = null; Converter<KeyInput, LongCommandResult> func2 = ki => { if (func(ki)) { return LongCommandResult.NewFinished(CommandResult.NewCompleted(ModeSwitch.NoSwitch)); } else { return LongCommandResult.NewNeedMoreInput(realFunc); } }; realFunc = func2; return LongCommandResult.NewNeedMoreInput(realFunc); }, flags); }
public long CombineAndStore(SetOperation operation, RedisKey destination, RedisKey first, RedisKey second, CommandFlags flags = CommandFlags.None) { return RedisSync.SetCombineAndStore(operation, destination, first, second, flags); }
public long CombineAndStore(SetOperation operation, RedisKey destination, RedisKey[] keys, CommandFlags flags = CommandFlags.None) { return RedisSync.SetCombineAndStore(operation, destination, keys, flags); }
/// <summary> /// Evaluates this LoadedLuaScript against the given database, extracting parameters for the passed in object if any. /// /// This method sends the SHA1 hash of the ExecutableScript instead of the script itself. If the script has not /// been loaded into the passed Redis instance it will fail. /// </summary> public Task<RedisResult> EvaluateAsync(IDatabaseAsync db, object ps = null, RedisKey? withKeyPrefix = null, CommandFlags flags = CommandFlags.None) { RedisKey[] keys; RedisValue[] args; Original.ExtractParameters(ps, withKeyPrefix, out keys, out args); return db.ScriptEvaluateAsync(Hash, keys, args, flags); }
private ServerEndPoint Select(int slot, RedisCommand command, CommandFlags flags) { flags = Message.GetMasterSlaveFlags(flags); // only intersted in master/slave preferences ServerEndPoint[] arr; if (slot == NoSlot || (arr = map) == null) return Any(command, flags); ServerEndPoint endpoint = arr[slot], testing; // but: ^^^ is the MASTER slots; if we want a slave, we need to do some thinking if (endpoint != null) { switch (flags) { case CommandFlags.DemandSlave: return FindSlave(endpoint, command) ?? Any(command, flags); case CommandFlags.PreferSlave: testing = FindSlave(endpoint, command); if (testing != null) return testing; break; case CommandFlags.DemandMaster: return FindMaster(endpoint, command) ?? Any(command, flags); case CommandFlags.PreferMaster: testing = FindMaster(endpoint, command); if (testing != null) return testing; break; } if (endpoint.IsSelectable(command)) return endpoint; } return Any(command, flags); }
/// <summary> /// 命令标志 /// </summary> /// <param name="commandName"></param> protected Command(CommandFlags commandName) { _commandName = commandName; }
internal static Command CreateVisualCommand( string name = "c", CommandFlags? flags = null, VisualKind kind = null, Func<FSharpOption<int>, Register, VisualSpan, CommandResult> func = null) { var flagsArg = flags ?? CommandFlags.None; kind = kind ?? VisualKind.Line; if (func == null) { func = (x, y, z) => CommandResult.NewCompleted(ModeSwitch.NoSwitch); } return Command.NewVisualCommand( KeyNotationUtil.StringToKeyInputSet(name), flagsArg, kind, func.ToFSharpFunc()); }
public bool StringSet(RedisKey key, RedisValue value, TimeSpan?expiry = null, When when = When.Always, CommandFlags flags = CommandFlags.None) { return(Inner.StringSet(ToInner(key), value, expiry, when, flags)); }
public bool StringSetBit(RedisKey key, long offset, bool bit, CommandFlags flags = CommandFlags.None) { return(Inner.StringSetBit(ToInner(key), offset, bit, flags)); }
public long StringLength(RedisKey key, CommandFlags flags = CommandFlags.None) { return(Inner.StringLength(ToInner(key), flags)); }
public bool StringSet(KeyValuePair <RedisKey, RedisValue>[] values, When when = When.Always, CommandFlags flags = CommandFlags.None) { return(Inner.StringSet(ToInner(values), when, flags)); }
public long StringIncrement(RedisKey key, long value = 1, CommandFlags flags = CommandFlags.None) { return(Inner.StringIncrement(ToInner(key), value, flags)); }
public double StringIncrement(RedisKey key, double value, CommandFlags flags = CommandFlags.None) { return(Inner.StringIncrement(ToInner(key), value, flags)); }
public RedisValueWithExpiry StringGetWithExpiry(RedisKey key, CommandFlags flags = CommandFlags.None) { return(Inner.StringGetWithExpiry(ToInner(key), flags)); }
void IServer.Hang(TimeSpan duration, CommandFlags flags) { var msg = Message.Create(-1, flags, RedisCommand.CLIENT, RedisLiterals.PAUSE, (long)duration.TotalMilliseconds); ExecuteSync(msg, ResultProcessor.DemandOK); }
public RedisValue StringSetRange(RedisKey key, long offset, RedisValue value, CommandFlags flags = CommandFlags.None) { return(Inner.StringSetRange(ToInner(key), offset, value, flags)); }
public long StringBitPosition(RedisKey key, bool bit, long start = 0, long end = -1, CommandFlags flags = CommandFlags.None) { return(Inner.StringBitPosition(ToInner(key), bit, start, end, flags)); }
public TimeSpan Ping(CommandFlags flags = CommandFlags.None) { return(Inner.Ping(flags)); }
protected GitCommand(GitMenuPackage provider, int id, CommandFlags selection, string text) : base(new CommandID(GuidList.GuidGitMenuCmdSet, id), text) { this.Selection = selection; Package = provider; }
public GeoPosition?GeoPosition(RedisKey key, RedisValue member, CommandFlags flags = CommandFlags.None) { return(Inner.GeoPosition(ToInner(key), member, flags)); }
/// <summary> /// Loads this LuaScript into the given IServer so it can be run with it's SHA1 hash, instead of /// passing the full script on each Evaluate or EvaluateAsync call. /// /// Note: the FireAndForget command flag cannot be set /// </summary> public LoadedLuaScript Load(IServer server, CommandFlags flags = CommandFlags.None) { if (flags.HasFlag(CommandFlags.FireAndForget)) { throw new ArgumentOutOfRangeException("flags", "Loading a script cannot be FireAndForget"); } var hash = server.ScriptLoad(ExecutableScript, flags); return new LoadedLuaScript(this, hash); }
IEnumerable <SortedSetEntry> IDatabase.SortedSetScan(RedisKey key, RedisValue pattern, int pageSize, CommandFlags flags) { return(SortedSetScan(key, pattern, pageSize, RedisBase.CursorUtils.Origin, 0, flags)); }
public ServerEndPoint Select(int db, RedisCommand command, RedisKey key, CommandFlags flags) { int slot = serverType == ServerType.Cluster ? HashSlot(key) : NoSlot; return Select(slot, command, flags); }
public IEnumerable <SortedSetEntry> SortedSetScan(RedisKey key, RedisValue pattern = default(RedisValue), int pageSize = RedisBase.CursorUtils.DefaultPageSize, long cursor = RedisBase.CursorUtils.Origin, int pageOffset = 0, CommandFlags flags = CommandFlags.None) { return(Inner.SortedSetScan(ToInner(key), pattern, pageSize, cursor, pageOffset, flags)); }
/// <summary> /// Evaluates this LuaScript against the given database, extracting parameters from the passed in object if any. /// </summary> public RedisResult Evaluate(IDatabase db, object ps = null, RedisKey? withKeyPrefix = null, CommandFlags flags = CommandFlags.None) { RedisKey[] keys; RedisValue[] args; ExtractParameters(ps, withKeyPrefix, out keys, out args); return db.ScriptEvaluate(ExecutableScript, keys, args, flags); }
public string ClientGetName(CommandFlags flags = CommandFlags.None) { return(Inner.ClientGetName(flags)); }
public RedisValue StringGetSet(RedisKey key, RedisValue value, CommandFlags flags = CommandFlags.None) { return(Inner.StringGetSet(ToInner(key), value, flags)); }
public void Quit(CommandFlags flags = CommandFlags.None) { Inner.Quit(flags); }
public Task<long> CombineAndStoreAsync(SetOperation operation, RedisKey destination, RedisKey[] keys, CommandFlags flags = CommandFlags.None) { return RedisAsync.SetCombineAndStoreAsync(operation, destination, keys, flags); }
public GeoRadiusResult[] GeoRadius(RedisKey key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.Meters, int count = -1, Order?order = null, GeoRadiusOptions options = GeoRadiusOptions.Default, CommandFlags flags = CommandFlags.None) { return(Inner.GeoRadius(ToInner(key), longitude, latitude, radius, unit, count, order, options, flags)); }
public Task<long> CombineAndStoreAsync(SetOperation operation, RedisKey destination, RedisKey first, RedisKey second, CommandFlags flags = CommandFlags.None) { return RedisAsync.SetCombineAndStoreAsync(operation, destination, first, second, flags); }
public long HashDecrement(RedisKey key, RedisValue hashField, long value = 1, CommandFlags flags = CommandFlags.None) { return(Inner.HashDecrement(ToInner(key), hashField, value, flags)); }
Task<string> IRedisAsync.ClientGetNameAsync(CommandFlags flags) { var msg = Message.Create(-1, flags, RedisCommand.CLIENT, RedisLiterals.GETNAME); return ExecuteAsync(msg, ResultProcessor.String); }
public long HashDelete(RedisKey key, RedisValue[] hashFields, CommandFlags flags = CommandFlags.None) { return(Inner.HashDelete(ToInner(key), hashFields, flags)); }
protected object Eval(string script, bool async = false, CommandFlags flags = CommandFlags.FireAndForget) { object result = null; var redisDatabase = GetRedisDatabase(); if (async) redisDatabase.ScriptEvaluateAsync(script); else result = redisDatabase.ScriptEvaluate(script, null, null, flags); return result; }
public bool HashDelete(RedisKey key, RedisValue hashField, CommandFlags flags = CommandFlags.None) { return(Inner.HashDelete(ToInner(key), hashField, flags)); }
public static CommandFlags GetMenuMask() { var pathToCheck = GetSelectedPath(); if (pathToCheck == _lastCheckedPath) return _lastMenuMask; _lastCheckedPath = pathToCheck; _lastMenuMask = GetMenuMask(_lastCheckedPath); return _lastMenuMask; }
/// <summary> /// HashValues /// </summary> /// <typeparam name="T"></typeparam> /// <param name="key"></param> /// <param name="hashField"></param> /// <param name="flags"></param> /// <returns></returns> public static ICollection <T> HashValues <T>(this IDatabase db, RedisKey key, CommandFlags flags = CommandFlags.None) where T : class { var values = db.HashValues(key, flags); if (values == null || values.Length == 0) { return(default(ICollection <T>)); } var results = new List <T>(); foreach (var value in values) { results.Add(JsonHelper.DeserializeObject <T>(value)); } return(results); }
protected GitCommand(GitMenuPackage provider, CommandID id, CommandFlags selection, string text) : base(id, text) { this.Selection = selection; Package = provider; }
/// <summary> /// HashSet /// </summary> /// <typeparam name="T"></typeparam> /// <param name="db"></param> /// <param name="key"></param> /// <param name="hashField"></param> /// <param name="value"></param> /// <param name="when"></param> /// <param name="flags"></param> /// <returns></returns> public static bool HashSet <T>(this IDatabase db, RedisKey key, RedisValue hashField, T value, When when = When.Always, CommandFlags flags = CommandFlags.None) where T : class { var json = JsonHelper.SerializeObject(value); return(db.HashSet(key, hashField, json, when, flags)); }
private CommandRunData CreateCommand( Func<FSharpOption<int>, Register, CommandResult> func = null, KeyInputSet name = null, CommandFlags? flags = null, int? count = 0, MotionRunData motionRunData = null, VisualSpan visualRunData = null) { name = name ?? KeyInputSet.NewOneKeyInput(KeyInputUtil.CharToKeyInput('c')); var flagsRaw = flags ?? CommandFlags.None; var countRaw = count.HasValue ? FSharpOption.Create(count.Value) : FSharpOption<int>.None; var funcRaw = func.ToFSharpFunc(); var cmd = Command.NewSimpleCommand( name, flagsRaw, func.ToFSharpFunc()); return new CommandRunData( cmd, new Register('c'), countRaw, motionRunData != null ? FSharpOption.Create(motionRunData) : FSharpOption<MotionRunData>.None, visualRunData != null ? FSharpOption.Create(visualRunData) : FSharpOption<VisualSpan>.None); }
/// <summary> /// HashSet /// </summary> /// <param name="db"></param> /// <param name="key"></param> /// <param name="hashFields"></param> /// <param name="flags"></param> public static void HashSet <T>(this IDatabase db, RedisKey key, RedisValue[] hashFields, T[] values, CommandFlags flags = CommandFlags.None) where T : class { var hashEntries = new HashEntry[hashFields.Length]; for (var i = 0; i < hashFields.Length; i++) { hashEntries[i] = new HashEntry(hashFields[i], JsonHelper.SerializeObject(values[i])); } db.HashSet(key, hashEntries, flags); }
public long StringBitOperation(Bitwise operation, RedisKey destination, RedisKey first, RedisKey second = default(RedisKey), CommandFlags flags = CommandFlags.None) { return(Inner.StringBitOperation(operation, ToInner(destination), ToInner(first), ToInnerOrDefault(second), flags)); }
/// <summary> /// Get /// </summary> /// <typeparam name="T"></typeparam> /// <param name="db"></param> /// <param name="key"></param> /// <param name="value"></param> /// <param name="expiry"></param> /// <param name="when"></param> /// <param name="flags"></param> /// <returns></returns> public static bool Set <T>(this IDatabase db, RedisKey key, T value, TimeSpan?expiry = null, When when = When.Always, CommandFlags flags = CommandFlags.None) where T : class { var json = JsonHelper.SerializeObject(value); return(db.StringSet(key, json, expiry, when, flags)); }
public long StringBitOperation(Bitwise operation, RedisKey destination, RedisKey[] keys, CommandFlags flags = CommandFlags.None) { return(Inner.StringBitOperation(operation, ToInner(destination), ToInner(keys), flags)); }
public long StringBitCount(RedisKey key, long start = 0, long end = -1, CommandFlags flags = CommandFlags.None) { return(Inner.StringBitCount(ToInner(key), start, end, flags)); }
private ServerEndPoint Any(RedisCommand command, CommandFlags flags) { return multiplexer.AnyConnected(serverType, (uint)Interlocked.Increment(ref anyStartOffset), command, flags); }
public RedisValue[] StringGet(RedisKey[] keys, CommandFlags flags = CommandFlags.None) { return(Inner.StringGet(ToInner(keys), flags)); }
private void LogNonPreferred(CommandFlags flags, bool isSlave) { if ((flags & Message.InternalCallFlag) == 0) // don't log internal-call { if (isSlave) { if (Message.GetMasterSlaveFlags(flags) == CommandFlags.PreferMaster) Interlocked.Increment(ref nonPreferredEndpointCount); } else { if (Message.GetMasterSlaveFlags(flags) == CommandFlags.PreferSlave) Interlocked.Increment(ref nonPreferredEndpointCount); } } }
public RedisValue[] Combine(SetOperation operation, RedisKey first, RedisKey second, CommandFlags flags = CommandFlags.None) { return RedisSync.SetCombine(operation, first, second, flags); }
/// <summary> /// Loads this LuaScript into the given IServer so it can be run with it's SHA1 hash, instead of /// passing the full script on each Evaluate or EvaluateAsync call. /// /// Note: the FireAndForget command flag cannot be set /// </summary> public async Task<LoadedLuaScript> LoadAsync(IServer server, CommandFlags flags = CommandFlags.None) { if (flags.HasFlag(CommandFlags.FireAndForget)) { throw new ArgumentOutOfRangeException(nameof(flags), "Loading a script cannot be FireAndForget"); } var hash = await server.ScriptLoadAsync(ExecutableScript, flags); return new LoadedLuaScript(this, hash); }
public Task<RedisValue[]> CombineAsync(SetOperation operation, RedisKey first, RedisKey second, CommandFlags flags = CommandFlags.None) { return RedisAsync.SetCombineAsync(operation, first, second, flags); }
public string GeoHash(RedisKey key, RedisValue member, CommandFlags flags = CommandFlags.None) { return(Inner.GeoHash(ToInner(key), member, flags)); }
public RedisValue StringGetRange(RedisKey key, long start, long end, CommandFlags flags = CommandFlags.None) { return(Inner.StringGetRange(ToInner(key), start, end, flags)); }