Ejemplo n.º 1
0
        public string GetValue(string key)
        {
            key = key.ToLowerInvariant().Trim();
            return(_memoryCache.GetOrCreate(key, _ =>
            {
                using var conn = _db.GetDbConnection();
                conn.Open();
                var result = conn.ExecuteScalar <string>(@"
SELECT m_value FROM META_INFO WHERE m_key = @Key;
", new { Key = key });
                conn.Close();
                return result;
            }));
        }
Ejemplo n.º 2
0
        public List <(int, string)> GetSiteContent(string host, int type)
        {
            using var conn = _db.GetDbConnection();
            conn.Open();
            var list = conn.Query <(int, string)>(@"SELECT id, content FROM SITES WHERE host=@host AND type=@type", new { host, type }).ToList();

            return(list);
        }