Example #1
0
        public override void Clear()
        {
            var api = new ApiPacket(10, 4);

            api.Set("sessionid", Id);
            var response = TcpFrame.Send(api);

            IsSuccess(response);
        }
Example #2
0
        public override void Remove(string key)
        {
            var api = new ApiPacket(10, 3);

            api.Set("sessionid", Id);
            api.Set("key", key);
            var response = TcpFrame.Send(api);

            IsSuccess(response);
        }
Example #3
0
        public override void Set(string key, byte[] value)
        {
            var api = new ApiPacket(10, 2);

            api.Set("sessionid", Id);
            api.Set("key", key);
            api.Bytes = value;
            var response = TcpFrame.Send(api);

            IsSuccess(response);
        }
Example #4
0
        public override IEnumerable <string> GetKeys()
        {
            var api = new ApiPacket(10, 0);

            api.Set("sessionid", Id);
            var response = TcpFrame.Send(api);

            IsSuccess(response);

            var _keys = response.Obj == null?Array.Empty <string>() : response.Obj.Split('|').AsEnumerable();

            return(_keys);
        }
Example #5
0
        public override bool TryGetValue(string key, out byte[] value)
        {
            var api = new ApiPacket(10, 1);

            api.Set("sessionid", Id);
            api.Set("key", key);
            var response = TcpFrame.Send(api);

            IsSuccess(response);

            value = response.Bytes;

            return(value != null);
        }