public static CachedResult <T> Cached <T>(
     this T actionResult,
     Cacheability cacheability = Cacheability.Private,
     string eTag                 = null,
     DateTimeOffset?expires      = null,
     DateTimeOffset?lastModified = null,
     TimeSpan?maxAge             = null,
     bool?noStore                = null) where T : IHttpActionResult
 {
     return(new CachedResult <T>(actionResult, cacheability, eTag, expires, lastModified, maxAge, noStore));
 }
Ejemplo n.º 2
0
 public CachedResult(
     T innerResult,
     Cacheability cacheability,
     string eTag,
     DateTimeOffset?expires,
     DateTimeOffset?lastModified,
     TimeSpan?maxAge,
     bool?noStore)
 {
     Cacheability = cacheability;
     ETag         = eTag;
     Expires      = expires;
     InnerResult  = innerResult;
     LastModified = lastModified;
     MaxAge       = maxAge;
     NoStore      = noStore;
 }
Ejemplo n.º 3
0
        private bool visible; // Is this paramater's tab visible.

        #endregion Fields

        #region Constructors

        public Parameter(ParameterDefinition pd)
        {
            definition = pd;
            value = null;
            dirty = true;
            defaultingWhenUnconnected = true;
            if (pd != null)
            {
                visible = pd.DefaultVisibility;
                cacheability = pd.DefaultCacheability;
            }
            else
            {
                visible = true;
                cacheability = Cacheability.OutputFullyCached;
            }
        }
 public ParameterDefinition(Symbol key)
     : base(key)
 {
     description = null;
     typeStrings = null;
     descriptive_default = false;
     default_value = null;
     is_input = false;
     required = false;
     default_visibility = true;
     viewable = true;
     Debug.Assert(Cacheability.OutputFullyCached == Cacheability.InputDerivesOutputCacheTag);
     defaultCacheability = Cacheability.OutputFullyCached;
     writeableCacheability = true;
     rerouteOutput = -1;
     dummy = false;
     valueOptions = null;
 }
Ejemplo n.º 5
0
        protected bool parseCommonComments(String comment, String file, int lineno)
        {
            Regex regex = new Regex(@" interaction mode = (.*)");
            Match m = regex.Match(comment);
            if (m.Success)
            {
                setInteractionMode(m.Groups[1].Value);

                // Now since this is the last comment, ask the ImageWindow
                // to refresh its state from our new cfg state.
                if (image != null)
                    image.updateFromNewCfgState();
                return true;
            }
            else if (comment.StartsWith(" internal caching:"))
            {
                regex = new Regex(@" internal caching: (\d+)");
                m = regex.Match(comment);
                if (m.Success)
                {
                    int cacheval = Int32.Parse(m.Groups[1].Value);
                    switch (cacheval)
                    {
                        case 0:
                            InternalCacheability = Cacheability.InternalsNotCached;
                            break;
                        case 1:
                            InternalCacheability = Cacheability.InternalsFullyCached;
                            break;
                        case 2:
                            InternalCacheability = Cacheability.InternalsCacheOnce;
                            break;
                        default:
                            return false;
                            break;
                    }
                    return true;
                }
            }
            return false;
        }
Ejemplo n.º 6
0
        public override void setDefaultCfgState()
        {
            saveInteractionMode = DirectInteractionMode.NONE;

            // Before resetting internal caching, check the net version number.
            // If it's 3.1.1 or later, then proceed.  We're preventing this reset
            // for older nets because older versions of dx did not write internal cache
            // value into both .net and .cfg files.  They wrote it only into the .net file.
            // So if we reset here, then we'll be throwing out the saved value.  For current
            // versions of dxui, it's OK to reset because we'll find a cache value in the
            // .cfg file.

            Network net = getNetwork();
            int net_major = net.getNetMajorVersion();
            int net_minor = net.getNetMinorVersion();
            int net_micro = net.getNetMicroVersion();
            int net_version = Utils.VersionNumber(net_major, net_minor, net_micro);
            int fixed_version = Utils.VersionNumber(3, 1, 1);
            if (net_version >= fixed_version)
            {
                ImageDefinition imnd = (ImageDefinition) Definition;
                internalCache = imnd.DefaultInternalCacheability;
            }
        }
Ejemplo n.º 7
0
        public ImageNode(NodeDefinition nd, Network net, int instnc)
            : base(nd, net, instnc)
        {
            initializeParams();
            ImageDefinition imnd = (ImageDefinition)nd;
            macroDirty = true;
            translating = false;

            // Anything below here also belongs in this->setDefaultCfgState().
            saveInteractionMode = DirectInteractionMode.NONE;
            internalCache = imnd.DefaultInternalCacheability;
        }
Ejemplo n.º 8
0
 bool TryGetCacheability(string item, out Cacheability result)
 {
     item.Replace("-", "");
     return(Enum.TryParse(item, out result));
 }
Ejemplo n.º 9
0
 public void setCacheability(Cacheability c)
 {
     Debug.Assert(!IsInput);
     if (cacheability != c)
     {
         cacheability = c;
         setDirty();
     }
 }
Ejemplo n.º 10
0
 public ImageDefinition()
 {
     defaultInternalCacheability = Cacheability.InternalsFullyCached;
 }
Ejemplo n.º 11
0
 public void setDefaultCacheability(Cacheability c)
 {
     defaultCacheability = c;
 }
Ejemplo n.º 12
0
 public Node(NodeDefinition nd, Network net, int inst)
 {
     network = net;
     instanceNumber = inst;
     setDefinition(nd);
     vpe_xpos = vpe_ypos = 0;
     labelSymbol = Symbol.zero;
     standin = null;
     cdb = null;
     moduleMessageId = null;
     nodeCacheability = nd.DefaultCacheability;
     buildParameterLists();
     marked = false;
     layout_information = null;
 }
Ejemplo n.º 13
0
        protected virtual void setIOCacheability(List<Parameter> io, int index, Cacheability c)
        {
            Parameter p;
            Debug.Assert(index >= 1);

            p = io[index - 1];
            Debug.Assert(p != null);

            if (c != p.getCacheability())
            {
                bool r = isIOCacheabilityWriteable(io, index);
                Debug.Assert(r);

                p.setCacheability(c);
                getNetwork().setDirty();
                if (cdb != null)
                    cdb.changeOutput(index);
            }
        }
Ejemplo n.º 14
0
 public void setOutputCacheability(int index, Cacheability c)
 {
     setIOCacheability(outputParameters, index, c);
 }
Ejemplo n.º 15
0
 public void setNodeCacheability(Cacheability val)
 {
     if (val != nodeCacheability)
     {
         nodeCacheability = val;
         getNetwork().setDirty();
     }
 }