Response HandleRequest(Request request)
        {
            string cacheKey = request?.Resource + "|" + request?.Payload?.ToString();
            var    resp     = cache.Get(cacheKey);

            if (resp == null)
            {
                resp = new RequestProcessor().HandleRequest(
                    requestHandlers,
                    request
                    );
                cache.Set(cacheKey, resp, 2000);
            }
            return((Response)resp);
        }
Example #2
0
        public Server(string pipeName, uint cacheMs)
        {
            Logger.Info("Initializing pipe server.");

            this.pipeName = pipeName;

            requestProcessor = new RequestProcessor();
            requestHandlers  = new Dictionary <string, Func <IRequestHandler> >();

            this.cache   = new Cache();
            this.cacheMs = cacheMs;

            ps = new PipeSecurity();
            var sid = new System.Security.Principal.SecurityIdentifier(System.Security.Principal.WellKnownSidType.BuiltinUsersSid, null);

            ps.AddAccessRule(new PipeAccessRule(sid, PipeAccessRights.ReadWrite, System.Security.AccessControl.AccessControlType.Allow));
        }