public CacheAttribute(string group, string name, CacheMode cacheMode) { Group = group; Name = name; this.CacheMode = cacheMode; this.CacheType = CacheType.Fetch; }
public NamedSQLQueryDefinition( string query, string resultSetRef, IList<string> querySpaces, bool cacheable, string cacheRegion, int timeout, int fetchSize, FlushMode flushMode, CacheMode? cacheMode, bool readOnly, string comment, IDictionary<string, string> parameterTypes, bool callable) : base( query.Trim(), /* trim done to workaround stupid oracle bug that cant handle whitespaces before a { in a sp */ cacheable, cacheRegion, timeout, fetchSize, flushMode, cacheMode, readOnly, comment, parameterTypes ) { this.resultSetRef = resultSetRef; this.querySpaces = querySpaces; this.callable = callable; }
/// <summary> /// Initializes a new instance of the ImageListViewCacheManager class. /// </summary> /// <param name="owner">The owner control.</param> public ImageListViewCacheManager(ImageListView owner) { lockObject = new object(); mImageListView = owner; mCacheMode = CacheMode.OnDemand; mCacheLimitAsItemCount = 0; mCacheLimitAsMemory = 20 * 1024 * 1024; mRetryOnError = owner.RetryOnError; toCache = new Stack<CacheItem>(); thumbCache = new Dictionary<Guid, CacheItem>(); editCache = new Dictionary<Guid, Image>(); rendererToCache = new Stack<CacheItem>(); rendererGuid = new Guid(); rendererItem = null; memoryUsed = 0; memoryUsedByRemoved = 0; removedItems = new List<Guid>(); mThread = new Thread(new ThreadStart(DoWork)); mThread.IsBackground = true; stopping = false; stopped = false; disposed = false; mThread.Start(); while (!mThread.IsAlive) ; }
private JetImageLoaderConfig(Builder builder) { IsLogEnabled = builder.IsLogEnabled; CacheMode = builder.CacheMode; DownloaderImpl = builder.DownloaderImpl; MemoryCacheImpl = builder.MemoryCacheImpl; StorageCacheImpl = builder.StorageCacheImpl; }
public DataMonitor(string connStr, string cmdStr, CommandType type, CacheMode mode) { _mode = mode; _conn = new SqlConnection(connStr); _cmd = new SqlCommand(cmdStr, _conn); _cmd.CommandType = type; if (_conn.State == ConnectionState.Closed) _conn.Open(); }
private static List<Book> loadFromWeb(CacheMode cMode, string[] testNumbers) { List<Book> books = new List<Book>(); foreach (string number in testNumbers) { Book newBook = new Book(number); newBook.LoadFromApi(cMode == CacheMode.NO); books.Add(newBook); } return books; }
public virtual ICache GetCacheHandler(CacheMode cacheMode) { switch (cacheMode) { case CacheMode.Local: return LocalCache; case CacheMode.Session: return SessionCache; case CacheMode.Request: return RequestCache; default: throw new NotImplementedException("CacheMode =" + cacheMode); } }
public NamedQueryDefinition( string query, bool cacheable, string cacheRegion, int timeout, int fetchSize, FlushMode flushMode, CacheMode? cacheMode, bool readOnly, string comment, IDictionary<string,string> parameterTypes ) { this.query = query; this.cacheable = cacheable; this.cacheRegion = cacheRegion; this.timeout = timeout; this.fetchSize = fetchSize; this.flushMode = flushMode; this.parameterTypes = parameterTypes; this.cacheMode = cacheMode; this.readOnly = readOnly; this.comment = comment; }
public CacheReadAttribute(CacheMode mode, bool shouldInvalidateOnError) : base(mode, shouldInvalidateOnError) { }
void HandleCacheFlushing(CacheMode newCacheMode, int cacheDelta, Texture newTexture) { if (currentCacheMode != newCacheMode || m_RenderState.Texture != (newTexture == null ? null : newTexture.sfTexture) || m_CacheSize + cacheDelta >= CacheSize) { FlushCache(); m_RenderState.Texture = (newTexture == null ? null : newTexture.sfTexture); currentCacheMode = newCacheMode; } }
public CacheReadAttribute(CacheMode mode, string lifeSpanRepresentation, bool shouldInvalidateOnError) : base(mode, lifeSpanRepresentation, shouldInvalidateOnError) { }
public override IDetachedQuery SetCacheMode(CacheMode cacheMode) { cacheModeWasSet = true; return base.SetCacheMode(cacheMode); }
/// <inheritdoc /> public async Task <IMessage> GetMessageAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null) => (await(SocketGroupChannel as IMessageChannel).GetMessageAsync(id, mode, options)) ?.Abstract();
/// <inheritdoc /> async Task <IReadOnlyCollection <IVoiceChannel> > IGuild.GetVoiceChannelsAsync(CacheMode mode, RequestOptions options) { if (mode == CacheMode.AllowDownload) { return(await GetVoiceChannelsAsync(options).ConfigureAwait(false)); } else { return(ImmutableArray.Create <IVoiceChannel>()); } }
public void Start(CacheMode mode) { if(_dep != null) Stop(); _dep = new SqlDependency(_cmd); _dep.OnChange += new OnChangeEventHandler(this.OnDataChange); if (OnData != null) { log.DebugFormat("DataMonitor [{0}] bubbled notification event to host.", Id); DataTable dt = GetData(); if (mode != CacheMode.Initialize) OnData(this, dt); } }
/// <inheritdoc /> IAsyncEnumerable <IReadOnlyCollection <IGuildUser> > IGuildChannel.GetUsersAsync(CacheMode mode, RequestOptions options) { return(mode == CacheMode.AllowDownload ? ChannelHelper.GetUsersAsync(this, Guild, Discord, null, null, options) : ImmutableArray.Create <IReadOnlyCollection <IGuildUser> >(Users).ToAsyncEnumerable()); }
public Task <IReadOnlyCollection <IAuditLogEntry> > GetAuditLogsAsync(int limit = 100, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null, ulong?beforeId = null, ulong?userId = null, ActionType?actionType = null) { throw new NotImplementedException(); }
/// <inheritdoc /> public async Task <IReadOnlyCollection <IVoiceChannel> > GetVoiceChannelsAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null) => (await(SocketGuild as IGuild).GetVoiceChannelsAsync(mode, options)) .Select(VoiceChannelAbstractionExtensions.Abstract) .ToArray();
/// <inheritdoc /> public async Task <IVoiceChannel> GetVoiceChannelAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null) => (await(SocketGuild as IGuild).GetVoiceChannelAsync(id, mode, options)) ?.Abstract();
/// <inheritdoc /> public async Task <ITextChannel> GetSystemChannelAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null) => (await(SocketGuild as IGuild).GetSystemChannelAsync(mode, options)) .Abstract();
/// <inheritdoc /> public async Task <IGuildUser> GetOwnerAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null) => (await(SocketGuild as IGuild).GetOwnerAsync(mode, options)) .Abstract();
public CacheAttribute(string group, string name, CacheMode cacheMode, CacheType cacheType) : this(group, name, cacheMode) { CacheType = cacheType; }
public CacheReadAttribute(CacheMode mode) : base(mode) { }
public IAsyncEnumerable <IReadOnlyCollection <IMessage> > GetMessagesAsync(IMessage fromMessage, Direction dir, int limit = 100, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null) { throw new NotImplementedException(); }
/// <inheritdoc /> public async Task <IReadOnlyCollection <IAuditLogEntry> > GetAuditLogsAsync(int limit = 100, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null) => (await(SocketGuild as IGuild).GetAuditLogsAsync(limit, mode, options)) .Select(AuditLogEntryAbstractionExtensions.Abstract) .ToArray();
public Task <IUser> GetUserAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null) { throw new NotImplementedException(); }
/// <summary> Override the current session cache mode, just for this query. /// </summary> /// <param name="cacheMode">The cache mode to use. </param> /// <returns> this (for method chaining) </returns> public IQuery SetCacheMode(CacheMode cacheMode) { this.cacheMode = cacheMode; return(this); }
public IAsyncEnumerable <IReadOnlyCollection <IUser> > GetUsersAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null) { throw new NotImplementedException(); }
/// <inheritdoc /> public IAsyncEnumerable <IReadOnlyCollection <IMessage> > GetMessagesAsync(int limit = 100, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null) => (SocketGroupChannel as IMessageChannel).GetMessagesAsync(limit, mode, options) .Select(x => x .Select(MessageAbstractionExtensions.Abstract) .ToArray());
public static IAsyncEnumerable <IReadOnlyCollection <IMessage> > GetMessagesAsync(ISocketMessageChannel channel, DiscordSocketClient discord, MessageCache messages, ulong?fromMessageId, Direction dir, int limit, CacheMode mode, RequestOptions options) { if (dir == Direction.Around) { throw new NotImplementedException(); //TODO: Impl } IReadOnlyCollection <SocketMessage> cachedMessages = null; IAsyncEnumerable <IReadOnlyCollection <IMessage> > result = null; if (dir == Direction.After && fromMessageId == null) { return(AsyncEnumerable.Empty <IReadOnlyCollection <IMessage> >()); } if (dir == Direction.Before || mode == CacheMode.CacheOnly) { if (messages != null) //Cache enabled { cachedMessages = messages.GetMany(fromMessageId, dir, limit); } else { cachedMessages = ImmutableArray.Create <SocketMessage>(); } result = ImmutableArray.Create(cachedMessages).ToAsyncEnumerable <IReadOnlyCollection <IMessage> >(); } if (dir == Direction.Before) { limit -= cachedMessages.Count; if (mode == CacheMode.CacheOnly || limit <= 0) { return(result); } //Download remaining messages ulong?minId = cachedMessages.Count > 0 ? cachedMessages.Min(x => x.Id) : fromMessageId; var downloadedMessages = ChannelHelper.GetMessagesAsync(channel, discord, minId, dir, limit, options); return(result.Concat(downloadedMessages)); } else { if (mode == CacheMode.CacheOnly) { return(result); } //Dont use cache in this case return(ChannelHelper.GetMessagesAsync(channel, discord, fromMessageId, dir, limit, options)); } }
public QueryOptions SetCacheMode(CacheMode mode) { action += criteria => criteria.SetCacheMode(mode); return this; }
/// <inheritdoc /> IQueryableOptions IQueryableOptions.SetCacheMode(CacheMode cacheMode) => SetCacheMode(cacheMode);
public SetCacheModeOpenSessionEvent(CacheMode cacheMode) { this.cacheMode = cacheMode; }
/// <summary> /// Override the current session cache mode, just for this query. /// </summary> /// <param name="cacheMode">The cache mode to use.</param> /// <returns><see langword="this"/> (for method chaining).</returns> public NhQueryableOptions SetCacheMode(CacheMode cacheMode) { CacheMode = cacheMode; return(this); }
/// <summary> /// Initializes a new instance of the ImageListView class. /// </summary> public ImageListView() { SetRenderer(new ImageListViewRenderer()); AllowColumnClick = true; AllowColumnResize = true; AllowDrag = false; AllowDuplicateFileNames = false; AllowPaneResize = true; BackColor = SystemColors.Window; mBorderStyle = BorderStyle.Fixed3D; mCacheMode = CacheMode.OnDemand; mCacheLimitAsItemCount = 0; mCacheLimitAsMemory = 20 * 1024 * 1024; mColumns = new ImageListViewColumnHeaderCollection(this); mDefaultImage = ImageListViewResources.image; mErrorImage = ImageListViewResources.exclamation; HeaderFont = this.Font; mItems = new ImageListViewItemCollection(this); mPaneWidth = 240; mRetryOnError = true; mSelectedItems = new ImageListViewSelectedItemCollection(this); mSortColumn = ColumnType.Name; mSortOrder = SortOrder.None; SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.Opaque | ControlStyles.Selectable | ControlStyles.UserMouse, true); Text = string.Empty; mThumbnailSize = new Size(96, 96); mUseEmbeddedThumbnails = UseEmbeddedThumbnails.Auto; mView = View.Thumbnails; mViewOffset = new Point(0, 0); hScrollBar = new HScrollBar(); vScrollBar = new VScrollBar(); hScrollBar.Visible = false; vScrollBar.Visible = false; hScrollBar.Scroll += new ScrollEventHandler(hScrollBar_Scroll); vScrollBar.Scroll += new ScrollEventHandler(vScrollBar_Scroll); layoutManager = new ImageListViewLayoutManager(this); forceRefresh = false; navigationManager = new ImageListViewNavigationManager(this); cacheManager = new ImageListViewCacheManager(this); itemCacheManager = new ImageListViewItemCacheManager(this); disposed = false; }
//IUser Task <IDMChannel> IUser.GetDMChannelAsync(CacheMode mode, RequestOptions options) => Task.FromResult <IDMChannel>(GlobalUser.DMChannel);
public CacheReadAttribute(CacheMode mode, string lifeSpanRepresentation) : base(mode, lifeSpanRepresentation) { }
/// <summary> /// Checks that specified cache exists and stops all Ignite instances. /// </summary> // ReSharper disable once UnusedParameter.Local private static void CheckCacheAndStop(string gridName, string cacheName, IgniteDbConfiguration cfg, CacheMode cacheMode = CacheMode.Partitioned) { try { Assert.IsNotNull(cfg); var ignite = Ignition.TryGetIgnite(gridName); Assert.IsNotNull(ignite); var metaCache = ignite.GetCache<object, object>(cacheName + "_metadata"); Assert.IsNotNull(metaCache); Assert.AreEqual(cacheMode, metaCache.GetConfiguration().CacheMode); if (cacheMode == CacheMode.Partitioned) Assert.AreEqual(1, metaCache.GetConfiguration().Backups); var dataCache = ignite.GetCache<object, object>(cacheName + "_data"); Assert.IsNotNull(dataCache); Assert.AreEqual(cacheMode, dataCache.GetConfiguration().CacheMode); if (cacheMode == CacheMode.Partitioned) Assert.AreEqual(0, dataCache.GetConfiguration().Backups); } finally { Ignition.StopAll(true); } }
public SetCacheModeEvent(CacheMode cacheMode) { this.cacheMode = cacheMode; }
public IAuditQuery SetCacheMode(CacheMode cacheMode) { this.cacheMode = cacheMode; return this; }
/// <inheritdoc /> async Task <IReadOnlyCollection <ICategoryChannel> > IGuild.GetCategoriesAsync(CacheMode mode, RequestOptions options) { if (mode == CacheMode.AllowDownload) { return(await GetCategoryChannelsAsync(options).ConfigureAwait(false)); } else { return(null); } }
/// <summary> /// Initializes a new instance of the ImageListView class. /// </summary> public ImageListView() { mColors = new ImageListViewColor(); SetRenderer(new ImageListViewRenderer()); AllowColumnClick = true; AllowColumnResize = true; AllowDrag = false; AllowDuplicateFileNames = false; AllowPaneResize = true; mBorderStyle = BorderStyle.Fixed3D; mCacheMode = CacheMode.OnDemand; mCacheLimitAsItemCount = 0; mCacheLimitAsMemory = 20 * 1024 * 1024; mColumns = new ImageListViewColumnHeaderCollection(this); ResourceManager manager = new ResourceManager("Manina.Windows.Forms.ImageListViewResources", Assembly.GetExecutingAssembly()); mDefaultImage = manager.GetObject("DefaultImage") as Image; mErrorImage = manager.GetObject("ErrorImage") as Image; HeaderFont = this.Font; mItems = new ImageListViewItemCollection(this); MultiSelect = true; mPaneWidth = 240; mRetryOnError = true; mSelectedItems = new ImageListViewSelectedItemCollection(this); mCheckedItems = new ImageListViewCheckedItemCollection(this); mSortColumn = ColumnType.Name; mSortOrder = SortOrder.None; SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.Opaque | ControlStyles.Selectable | ControlStyles.UserMouse, true); ScrollBars = true; mShowCheckBoxes = false; mCheckBoxAlignment = ContentAlignment.BottomRight; mCheckBoxPadding = new Size(2, 2); mShowFileIcons = false; mIconAlignment = ContentAlignment.TopRight; mIconPadding = new Size(2, 2); Text = string.Empty; mThumbnailSize = new Size(96, 96); mUseEmbeddedThumbnails = UseEmbeddedThumbnails.Auto; mView = View.Thumbnails; mViewOffset = new Point(0, 0); hScrollBar = new HScrollBar(); vScrollBar = new VScrollBar(); hScrollBar.Visible = false; vScrollBar.Visible = false; hScrollBar.Scroll += new ScrollEventHandler(hScrollBar_Scroll); vScrollBar.Scroll += new ScrollEventHandler(vScrollBar_Scroll); layoutManager = new ImageListViewLayoutManager(this); forceRefresh = false; navigationManager = new ImageListViewNavigationManager(this); cacheManager = new ImageListViewCacheManager(this); itemCacheManager = new ImageListViewItemCacheManager(this); disposed = false; }
/// <inheritdoc /> IAsyncEnumerable <IReadOnlyCollection <IMessage> > IMessageChannel.GetMessagesAsync(int limit, CacheMode mode, RequestOptions options) => SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, null, Direction.Before, limit, mode, options);
/// <inheritdoc /> IAsyncEnumerable <IReadOnlyCollection <IMessage> > IMessageChannel.GetMessagesAsync(IMessage fromMessage, Direction dir, int limit, CacheMode mode, RequestOptions options) { if (mode == CacheMode.AllowDownload) { return(GetMessagesAsync(fromMessage, dir, limit, options)); } else { return(AsyncEnumerable.Empty <IReadOnlyCollection <IMessage> >()); } }
private DataPoint CreateDataPoint(CacheMode mode) { DataPoint dp = null; using (ISession s = OpenSession()) { s.CacheMode = CacheMode.Ignore; using (ITransaction t = s.BeginTransaction()) { dp = new DataPoint(); dp.X = 0.1M; dp.Y = (decimal)System.Math.Cos((double)dp.X); dp.Description = "original"; s.Save(dp); t.Commit(); } } return dp; }
/// <inheritdoc /> IAsyncEnumerable <IReadOnlyCollection <IMessage> > IMessageChannel.GetMessagesAsync(IMessage fromMessage, Direction dir, int limit, CacheMode mode, RequestOptions options) => SocketChannelHelper.GetMessagesAsync(this, Discord, _messages, fromMessage.Id, dir, limit, mode, options);
/// <inheritdoc /> IAsyncEnumerable <IReadOnlyCollection <IGuildUser> > IGuildChannel.GetUsersAsync(CacheMode mode, RequestOptions options) => ImmutableArray.Create <IReadOnlyCollection <IGuildUser> >(Users).ToAsyncEnumerable();
// INestedChannel /// <inheritdoc /> Task <ICategoryChannel> INestedChannel.GetCategoryAsync(CacheMode mode, RequestOptions options) => Task.FromResult(Category);
/// <summary> Override the current session cache mode, just for this query. </summary> /// <param name="cacheMode">The cache mode to use. </param> /// <returns> this (for method chaining) </returns> public virtual IDetachedQuery SetCacheMode(CacheMode cacheMode) { this.cacheMode = cacheMode; return this; }
//IGuildChannel /// <inheritdoc /> Task <IGuildUser> IGuildChannel.GetUserAsync(ulong id, CacheMode mode, RequestOptions options) => Task.FromResult <IGuildUser>(GetUser(id));
/// <summary> /// Initializes a new instance of the ImageListView class. /// </summary> public ImageListView() { // Renderer parameters controlSuspended = false; rendererSuspendCount = 0; rendererNeedsPaint = true; mColors = ImageListViewColor.Default; Renderer = new ImageListViewRenderer(); // Property defaults AutoRotateThumbnails = true; AllowCheckBoxClick = true; AllowColumnClick = true; AllowColumnResize = true; AllowDrag = false; AllowDuplicateFileNames = false; AllowPaneResize = true; mBorderStyle = BorderStyle.Fixed3D; mCacheMode = CacheMode.OnDemand; mCacheLimitAsItemCount = 0; mCacheLimitAsMemory = 20 * 1024 * 1024; mColumns = new ImageListViewColumnHeaderCollection(this); resources = new ResourceManager("Manina.Windows.Forms.ImageListViewResources", typeof(ImageListView).Assembly); mDefaultImage = resources.GetObject("DefaultImage") as Image; mErrorImage = resources.GetObject("ErrorImage") as Image; mRatingImage = resources.GetObject("RatingImage") as Image; mEmptyRatingImage = resources.GetObject("EmptyRatingImage") as Image; GroupHeaderFont = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Bold); ColumnHeaderFont = new Font("Microsoft Sans Serif", 8.25f); mIntegralScroll = false; mItems = new ImageListViewItemCollection(this); MultiSelect = true; mPaneWidth = 240; mRetryOnError = true; mSelectedItems = new ImageListViewSelectedItemCollection(this); mCheckedItems = new ImageListViewCheckedItemCollection(this); mSortColumn = 0; mGroupColumn = 0; mSortOrder = SortOrder.None; mGroupOrder = SortOrder.None; SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.Opaque | ControlStyles.Selectable | ControlStyles.UserMouse, true); ScrollBars = true; ShellIconFallback = true; ShellIconFromFileContent = true; Size = new Size(120, 100); mShowCheckBoxes = false; mCheckBoxAlignment = ContentAlignment.BottomRight; mCheckBoxPadding = new Size(2, 2); mShowFileIcons = false; mIconAlignment = ContentAlignment.TopRight; mIconPadding = new Size(2, 2); Text = string.Empty; mThumbnailSize = new Size(96, 96); mUseEmbeddedThumbnails = UseEmbeddedThumbnails.Auto; mUseWIC = UseWIC.Auto; mView = View.Thumbnails; mViewOffset = new Point(0, 0); mShowScrollBars = true; // Child controls hScrollBar = new HScrollBar(); vScrollBar = new VScrollBar(); hScrollBar.Visible = false; vScrollBar.Visible = false; hScrollBar.Scroll += hScrollBar_Scroll; vScrollBar.Scroll += vScrollBar_Scroll; Controls.Add(hScrollBar); Controls.Add(vScrollBar); // Groups groups = new ImageListViewGroupCollection(this); showGroups = false; // Lazy refresh timer lazyRefreshTimer = new System.Timers.Timer(); lazyRefreshTimer.Interval = ImageListViewRenderer.LazyRefreshInterval; lazyRefreshTimer.Enabled = false; lazyRefreshTimer.Elapsed += lazyRefreshTimer_Tick; lazyRefreshCallback = new RefreshDelegateInternal(Refresh); // Helpers layoutManager = new ImageListViewLayoutManager(this); navigationManager = new ImageListViewNavigationManager(this); // Cache nabagers defaultAdaptor = new ImageListViewItemAdaptors.FileSystemAdaptor(); thumbnailCache = new ImageListViewCacheThumbnail(this); shellInfoCache = new ImageListViewCacheShellInfo(this); metadataCache = new ImageListViewCacheMetadata(this); disposed = false; }
async Task <IReadOnlyCollection <IAuditLogEntry> > IGuild.GetAuditLogsAsync(int limit, CacheMode cacheMode, RequestOptions options) { if (cacheMode == CacheMode.AllowDownload) { return((await GetAuditLogsAsync(limit, options).FlattenAsync().ConfigureAwait(false)).ToImmutableArray()); } else { return(ImmutableArray.Create <IAuditLogEntry>()); } }