Exemplo n.º 1
0
        public async Task <LogResultModel> Log(string token, object data)
        {
            var            encodedVallue = Base64Utility.Encode(token.ToString());
            LogResultModel result        = await base.Post <LogResultModel>("log", encodedVallue, data);

            return(result);
        }
Exemplo n.º 2
0
        public async Task <AuthResultModel> Authenticate(string token)
        {
            var             encodedVallue = Base64Utility.Encode(token.ToString());
            AuthResultModel result        = await base.Post <AuthResultModel>("auth", encodedVallue, null);

            return(result);
        }
Exemplo n.º 3
0
        private string CompressContent(object content)
        {
            var serializedContent = JsonConvert.SerializeObject(content);
            var compressedContent = Base64Utility.Encode(serializedContent);

            return(compressedContent);
        }
Exemplo n.º 4
0
        public void Set(string key, object content)
        {
            var cacheKey          = Base64Utility.Encode(key);
            var compressedContent = CompressContent(content);

            _cache.Set(cacheKey, compressedContent, TimeSpan.FromMinutes(_config.Expiration));
        }
Exemplo n.º 5
0
        public bool TryGet <T>(string key, out T content)
        {
            var cacheKey = Base64Utility.Encode(key);

            if (!_cache.TryGetValue(cacheKey, out string compressedContent))
            {
                content = default(T);
                return(false);
            }

            content = DecompressContent <T>(compressedContent);
            return(true);
        }