Prompt stringlengths 14 160 | Instruction stringlengths 18 2k | Response stringlengths 8 2k |
|---|---|---|
Force Hibernate to read database and not return cached entity |
I am using Hibernate and Spring for my web application.
In database operation, Hibernate is caching entities and returning them in next request without reading the actual database. I know this will reduce the load on database and improve performance.
But while this app still under construction, I need to load data fr... |
session.refresh(entity) or entityManager.refresh(entity) (if you use JPA) will give you fresh data from DB.
|
How to Cache InputStream for Multiple Use |
I have an InputStream of a file and i use apache poi components to read from it like this:
POIFSFileSystem fileSystem = new POIFSFileSystem(inputStream);
The problem is that i need to use the same stream multiple times and the POIFSFileSystem closes the stream after use.
What is the best way to cache the data from th... |
you can decorate InputStream being passed to POIFSFileSystem with a version that when close() is called it respond with reset():
class ResetOnCloseInputStream extends InputStream {
private final InputStream decorated;
public ResetOnCloseInputStream(InputStream anInputStream) {
if (!anInputStream.mark... |
Can I force .htaccess to refresh? |
We are moving a site from one CMS to another. The .htaccess file has been changed and it needs to be refreshed for the new site to work right. From what I understand the .htaccess file will only be refreshed if the browser cache is cleared? It is fine for those creating the site to clear our cache, but is there a way ... |
If you're using RewriteRule, just use R instead of R=301. For other purposes, you'll have to clear your browser cache whenever you change a redirect.
from https://stackoverflow.com/a/7749784/1066234
|
what are pagecache, dentries, inodes? |
Just learned these 3 new techniques from https://unix.stackexchange.com/questions/87908/how-do-you-empty-the-buffers-and-cache-on-a-linux-system:
To free pagecache:
# echo 1 > /proc/sys/vm/drop_caches
To free dentries and inodes:
# echo 2 > /proc/sys/vm/drop_caches
To free pagecache, dentries and inodes:
# echo 3 >... |
With some oversimplification, let me try to explain in what appears to be the context of your question because there are multiple answers.
It appears you are working with memory caching of directory structures. An inode in your context is a data structure that represents a file. A dentries is a data structure that rep... |
No expires header sent, content cached, how long until browser makes conditional GET request? |
Assume browser default settings, and content is sent without expires headers.
user visits website, browser caches images etc.
user does not close browser, or refresh page.
user continues to surf site normally.
assume the browse doesn't dump the cache for any reason.
The browser will cache images etc as the user ... |
HTTP/1.1 defines a selection of caching mechanisms; the expires header is merely one, there is also the cache-control header.
To directly answer your question: for a resource returned with no expires header, you must consider the returned cache-control directives.
HTTP/1.1 defines no caching behaviour for a resource s... |
Apollo GraphQl react. How to clear query cache for all variable combinations? |
I am using apollo graphql in my react application.
Say I have the following query:
query ListQuery($filter: String!) {
items(filter: $filter) {
id
name
}
}
This query lets me query a list of items using a filter. Say I used filter string A, and then used filter string B. The cache would now contain tw... |
12
In your case, you can use the apollo's method
client.resetStore();
It will clear the previous cache and then load the active queries.
Share
Improve this answer
Follow
answered Apr 24, 2018 at ... |
Laravel 5.3 - Clear config cache in shared hosting |
Currently I'm working on small project that require me to host my laravel app on shared hosting (please ignore the reason why I didn't use VPS to host my laravel project) and this hosting provider disable escapeshellarg() for security reason so I can't use php artisan config:cache to clear config cache.
Is there any w... |
config:clear command just deletes bootstrap/cache/config.php file, so just delete this file manually.
|
What is the difference between HttpContext.Current.Cache.Insert and HttpContext.Current.Cache.Add |
I'm working on an ASP.NET web application and I want to implement caching, so I want to know the difference between HttpContext.Current.Cache.Insert and HttpContext.Current.Cache.Add and which one is better?
|
The main difference between the two is that if an object with the same name already exists in the cache, the Insert method call on your instance of Cache will replace the object, whereas the Add method call will fail (taken from the Remarks paragraph of methods Add and Insert on their respective MSDN reference page):
... |
How do I clear the server cache in asp.net? |
How do I clear the server cache in asp.net? I have found out that there are two kinds of the cache. There is the browser cache and the server cache. I have done some searching but I have yet to find a clear, step-by-step guide for clearing the server cache using asp.net (or not).
(update) I just learned that the code... |
50
You could loop through all the cache items and delete them one by one:
foreach (System.Collections.DictionaryEntry entry in HttpContext.Current.Cache){
HttpContext.Current.Cache.Remove(string(entry.Key));
}
Syntax Correction for ASP.NET 4.5 C#
foreach (System.Collec... |
How to disable MySQL Query Caching |
I am trying to do some benchmarking of different queries on different columns but MySQL just won't let me do it. After the first execution of a query, I can never get the same execution time for that query again. For example if the query executes in 0.062 secs the first time, I can never get the same execution time fo... |
Running the query for the first time makes InnoDB buffer pool populate with your tables' relevant blocks.
Since re-running the query requires exactly same blocks, it spares the query from the need to read them from disk when it's re-run, making it significantly faster.
|
Chrome caching like a mad browser |
I've got a web service that, like most others, uses js and css files. I use the old trick of appending a version number to the js and css file like; ?v=123 and that gets changed every time we update the service on production.
Now, this works fine on all browsers, except for Chrome. Chrome seems to prefer it's cached... |
Chrome should certainly treat requests with varying query strings as different requests; a cached result for style.css?v=123 should never be used for style.css?v=124. If you're seeing different behavior, please file a bug at http://new.crbug.com/ and post the bug ID here.
That said, I'd first check to see whether the ... |
Disable Volley cache management |
Is there a way I could disable the Volley cache management? My app is using Google Volley library to manage the transport layer, but I have my own cache manager implementation because the server does not uses Cache-Control header. I want to save the space that Volley cache is using because it is totally useless.
Is th... |
If you use any of the default Request classes implemented in volley(e.g. StringRequest, JsonRequest, etc.), then call setShouldCache(false) right before adding the request object to the volley RequestQueue:
request.setShouldCache(false);
myQueue.add(request);
If you have your own implementation of the Request class, ... |
React Native - Fetch call cached |
I am building an app in react native which makes fetch calls that rely on the most up to date information from the server. I have noticed that it seems to cache the response and if i run that fetch call again it returns the cached response rather than the new information from my server.
My function is as follows:
goTo... |
You can set a Header to prevent the request from being cached.
Example below:
return fetch(url, {
headers: {
'Cache-Control': 'no-cache'
}
}).then(function (res) {
return res.json();
}).catch(function(error) {
console.warn('Request Failed: ', error);
});
|
What could be adding "Pragma:no-cache" to my response Headers? (Apache, PHP) |
I have a website which maintenance I've inherited, which is a big hairy mess.
One of the things I'm doing is improving performance. Among other things, I'm adding Expires headers to images.
Now, there are some images that are served through a PHP file, and I notice that they do have the Expires header, but they also g... |
Create a simple file that includes none of your PHP libraries but lives in the same folder as the file that serves up your images through a PHP file.
file: test.php
Request this file through a browser and check the headers. If you see the Response headers that you don't want, you know that they're configured via apa... |
How to disable hibernate caching |
I am trying to write a unit test class which will have to use same query to fetch the results from database two times in same test method. But as Hibernate cache is enabled second time it is not actually hitting the database and simply fetching the results from cache.
Can someone please answer how to disable caching i... |
24
Can someone please answer how to disable caching in persistence.xml.
The second-level cache and query cache are disabled by default (and queries are not cached unless you explicitly cache them). The first-level cache can't be disabled.
I tried to disable by changing ... |
Spring Cacheable vs CachePut? |
@CachePut or @Cacheable(value = "CustomerCache", key = "#id")
public Customer updateCustomer(Customer customer) {
sysout("i am inside updateCustomer");
....
return customer;
}
I found below documentation under CachePut source code
CachePut annotation does not cause the target method to be skipped -
rath... |
Yes.
I even made a test to be sure:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = CacheableTest.CacheConfigurations.class)
public class CacheableTest {
public static class Customer {
final private String id;
final private String name;
public Customer(String id, ... |
How to tell OkHttpClient to ignore cache and force refresh from server? |
In my android application, I am using Retrofit with OkHttpClient with caching enabled to access some APIs. Some of our APIs sometimes return empty data. We provide a "Refresh" button in the app for the client to reload data from a specific API.
How do I tell OkHttpClient that a specific request should ignore the cache... |
31
As Jake Wharton suggested in issues, do this to ignore the cache:
request.setCacheControl(CacheControl.FORCE_NETWORK);
Share
Improve this answer
Follow
edited May 16, 2016 at 15:44
gokhanakkurt
... |
Redis vs MemoryCache |
Redis is often used as a cache, although it offers a lot more than just in-memory caching (it supports persistence, for instance).
What are the reasons why one would choose to use Redis rather than the .NET MemoryCache? Persistence and data types (other than key-value pairs) come to mind, but I'm sure there must be ot... |
MemoryCache is embedded in the process , hence can only be used as a plain key-value store from that process.
An seperate server counterpart of MemoryCache would be memcached.
Whereas redis is a data structure server which can be hosted on other servers can interacted with over the network just like memcached , but re... |
Asking browsers to cache as aggressively as possible |
This is about a web app that serves images. Since the same request will always return the same image, I want the accessing browsers to cache the images as aggressively as possible. I pretty much want to tell the browser
Here's your image. Go ahead and keep it; it's really not going to change for the next couple of da... |
You may be interested in checking out the following Google Code article:
Optimize caching: Leverage browser caching
In a nutshell, all modern browsers should be able to cache your images appropriately as instructed, with those HTTP headers.
|
Cached non CORS response conflicts with new CORS request |
Gist:
I have a page that uses tag loading of an image from s3 (HTML img tag) and I have a page that uses xmlhttprequest. The tag loading gets cached without the CORS headers and so the xmlhttprequest sees the cached version, checks it's headers and fails with a cross origin error.
Details:
edit: Fails in both safari 5... |
9
I ran into the same problem. As @monsur said, the problem is that S3 doesn't set teh "Vary: Origin" header, even though it should. Unfortunately, as far as I know there is no way to get S3 to send that header. However, you can work around this by adding a query string p... |
How to cache database tables to prevent many database queries in Asp.net C# mvc |
I build my own cms using Asp.net mvc 4 (c#), and I want to cache some database data, likes: localization, search categories (it's long-tail, each category have it's own sub and sub-sub categories), etc..
It's will be overkill to query the database all the time, because it can be more than 30-100 queries for each page... |
You could use the built-in MemoryCache to store entire resultsets you have retrieved from the database.
A typical pattern:
MyModel model = MemoryCache.Default["my_model_key"] as MyModel;
if (model == null)
{
model = GetModelFromDatabase();
MemoryCache.Default["my_model_key"] = model;
}
// you could use the mo... |
Caching and gzip compression by htaccess |
Can someone provide me with an optimized .htaccess configuration that handles compression, browser caching, proxy caching, etc. for a typical website?
Aside from my visitors, I'm also trying to make Google PageSpeed happy.
I wanna use caching and gzip compression through .htaccess please help me with its code!
I want ... |
# 480 weeks
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Cache-Control "max-age=290304000, public"
</FilesMatch>
# 2 DAYS
<FilesMatch "\.(xml|txt)$">
Header set Cache-Control "max-age=172800, public, must-revalidate"
</FilesMatch>
# 2 HOURS
<FilesMatch "\.(html|htm)$">
Header set Cache-Cont... |
How to stop Doctrine 2 from caching a result in Symfony 2? |
I want to be able to retrieve the existing version of an entity so I can compare it with the latest version. E.g. Editing a file, I want to know if the value has changed since being in the DB.
$entityManager = $this->get('doctrine')->getEntityManager();
$postManager = $this->get('synth_knowledge_share.manager'... |
It's a normal behavior.
Doctrine stores a reference of the retrieved entities in the EntityManager so it can return an entity by it's id without performing another query.
You can do something like :
$entityManager = $this->get('doctrine')->getEntityManager();
$repository = $entityManager->getRepository('KnowledgeShare... |
MySQL query caching: limited to a maximum cache size of 128 MB? |
My application is very database intensive so I've tried really hard to make sure the application and the MySQL database are working as efficiently as possible together.
Currently I'm tuning the MySQL query cache to get it in line with the characteristics of queries being run on the server.
query_cache_size is the maxi... |
Usually "too big cache size" warnings are issued under assumption that you have few physical memory and the cache itself well need to be swapped or will take resources that are required by the OS (like file cache).
If you have enough memory, it's safe to increase query_cache size (I've seen installations with 1GB quer... |
Manually clear ASP.NET server cache for a single application/web site? |
How can I manually clear ASP.NET server cache (IIS 7) on a given application/website, like what can be done in IE to clear browser cache for a given domain?
|
50
Use the following to remove all objects from the cache
IDictionaryEnumerator enumerator = HttpContext.Current.Cache.GetEnumerator();
while (enumerator.MoveNext())
{
HttpContext.Current.Cache.Remove((string)enumerator.Key);
}
Also, it is a bit of a sledgehammer op... |
HttpContext.Cache Expiration |
Is there a way to specify how long data is held in HttpContext.Cache?
|
You can specify it in the 4th parameter of Cache.Add():
public Object Add(
string key,
Object value,
CacheDependency dependencies,
DateTime absoluteExpiration, // After this DateTime, it will be removed from the cache
TimeSpan slidingExpiration,
CacheItemPriority priority,
CacheItemRemoved... |
How do you implement caching in Linq to SQL? |
We've just started using LINQ to SQL at work for our DAL & we haven't really come up with a standard for out caching model. Previously we had being using a base 'DAL' class that implemented a cache manager property that all our DAL classes inherited from, but now we don't have that. I'm wondering if anyone has come ... |
A quick answer: Use the Repository pattern (see Domain Driven Design by Evans) to fetch your entities. Each repository will cache the things it will hold, ideally by letting each instance of the repository access a singleton cache (each thread/request will instantiate a new repository but there can be only one cache).... |
PHP Best way to cache MySQL results? |
I am currently building a PHP framework (original, i know) and im working on some optimisation features for it. One dilema I have come accross is what is the best way to cache MySQL results? I know some people will say, first optimise your MySQL etc, but lets say for arguments sake, my query takes 1 minute to run and... |
If this is a straight array, then you could use var_export() rather than serialize (wrapping it with the appropriate "" and write it to a .php file; then include() that in your script. Best done if you can write it outside the htdocs tree, and only really appropriate for large volumes of data that memory caches would ... |
MS Velocity vs Memcached for Windows? |
I've been paying some attention to Microsoft's fairly recent promoting of Velocity as a distributed caching solution that would compete with the likes of Memcached.
I've been looking for a 64bit version of Memcached for Windows for some time now with no luck, and since everything about the ASP.Net MVC project I'm work... |
We have done recently a fair amount of comparing of Velocity and Memcached. In the nutshell, we found Velocity to be 3x - 5x slower than Memcached, and (even more crucially) it does not have currently support for a multi-get operation. So at the moment, I would recommend going with Memcached. Also, another lesson we h... |
How to force a web browser to cache Images |
I am writing a small application which serves images from the local computer, so they can be accessed as http://localhost:12345/something/something (which returns a jpeg).
How can I force the browser to cache this, so only a single request would be sent to the server. Would this header be sufficient
HTTP/1.1 200 OK
C... |
17
A Last-Modified and Expires header might also be useful additions.
Your server should also check for requests featuring an If-Modified-Since header, and return a 304 Not Modified response if possible to speed things along.
Share
Improve this answer
... |
Disable SQL Cache temporary in Rails? |
I'm currently creating a Rails app with some cronjobs etc, but I have some problems because the sql is cached by Rails.
So anyone know how to disable the SQL Cache in Rails? Not globally, but for this code. Really don't want to create one method for every model, so is there anyway to just disable it temporary?
Terw
|
Solved with model.connection.clear_query_cache
|
Where are .NET 4.0 MemoryCache performance counters? |
Where are .NET 4.0 MemoryCache performance counters?
I am looking for their name and I can't find any.
Thank you,
|
That's a loaded question with a very long answer. I doubt it is going to be helpful, let's talk about the real problem you are trying to solve. Those performance counters have to be registered first before you can see them.
Start an elevated console prompt (right-click the shortcut and use Run as Administrator) and ... |
Can a proxy server cache SSL GETs? If not, would response body encryption suffice? |
Can a (||any) proxy server cache content that is requested by a client over https? As the proxy server can't see the querystring, or the http headers, I reckon they can't.
I'm considering a desktop application, run by a number of people behind their companies proxy. This application may access services across the inte... |
No, it's not possible to cache https directly. The whole communication between the client and the server is encrypted. A proxy sits between the server and the client, in order to cache it, you need to be able to read it, ie decrypt the encryption.
You can do something to cache it. You basically do the SSL on your prox... |
Why use System.Runtime.Caching or System.Web.Caching Vs static variables? |
Long time listener - first time caller. I am hoping to get some advice. I have been reading about caching in .net - both with System.Web.Caching and System.Runtime.Caching. I am wondering what additional benefits I can get vs simply creating a static variable with locking. My current (simple minded) caching metho... |
First of all, Xaqron makes a good point that what you're talking about probably doesn't qualify as caching. It's really just a lazily-loaded globally-accessible variable. That's fine: as a practical programmer, there's no point bending over backward to implement full-on caching where it's not really beneficial. If yo... |
.NET 4 Caching Support |
I understand the .NET 4 Framework has caching support built into it. Does anyone have any experience with this, or could provide good resources to learn more about this?
I am referring to the caching of objects (entities primarily) in memory, and probably the use of System.Runtime.Caching.
|
I assume you are getting at this, System.Runtime.Caching, similar to the System.Web.Caching and in a more general namespace.
See http://deanhume.com/Home/BlogPost/object-caching----net-4/37
and on the stack,
is-there-some-sort-of-cachedependency-in-system-runtime-caching and,
performance-of-system-runtime-caching.
Cou... |
What do the size settings for MemoryCache mean? |
In a controller class, I have
using Microsoft.Extensions.Caching.Memory;
private IMemoryCache _cache;
private readonly MemoryCacheEntryOptions CacheEntryOptions = new MemoryCacheEntryOptions()
.SetSize(1)
// Keep in cache for this time
.SetAbsoluteExpiration(TimeSpan.FromSeconds(CacheExpiryInSeconds));
An... |
I was able to hunt down some helpful documentation.
SizeLimit does not have units. Cached entries must specify size in whatever units they deem most appropriate if the cache size limit has been set. All users of a cache instance should use the same unit system. An entry will not be cached if the sum of the cached ent... |
Does SQL Server CACHES Query Results? [duplicate] |
This question already has answers here:
SQL Server cache question
(5 answers)
Closed 10 years ago.
When I run a query does the SQL Server caches the results?
Because:
When I run th... |
36
SQL Server does not cache the query results, but it caches the data pages it reads in memory. The data from these pages is then used to produce the query result.
You can easily see if the data was read from memory or from disk by setting
SET STATISTICS IO ON
Which retur... |
Using Spring cache annotation in multiple modules |
I have a util module that produces a jar to be used in other applications. I'd like this module to use caching and would prefer to use Spring's annotation-driven caching.
So Util-Module would have something like this:
DataManager.java
...
@Cacheable(cacheName="getDataCache")
public DataObject getData(String key) { .... |
this seems to be fixed in 3.2M1, see https://jira.springsource.org/browse/SPR-8696
|
Yarn cache takes a lot of space |
I was shocked few minutes ago when I figured it out that Yarn cache on location /Users/user/Library/Caches/Yarn takes more than 50GB of my disk space.
What the heck? Why is there every existing package in this universe on my computer?
I am glad that Yarn advertise itself as ultra fast, but in compensation with eating... |
Yarn website says the following:-
Yarn stores every package in a global cache in your user directory on the file system.
You can use yarn cache list & it will print out every cached package. Just in case you wanted to go through.
You can use yarn cache clean & it will clean the cache (Note that it's a time taking p... |
Caching Solutions |
Has anyone done a thorough comparison of AppFabric and NCache or AppFabric and ScaleOut? We are currently looking to implement either AppFabric, NCache or ScaleOut for distributed caching in geographically distant locations and I would like to know anyone's thoughts who has compared them side by side. I appreciate tha... |
4
Here is a good comparison between the features of NCache and Appfabric
Share
Improve this answer
Follow
answered May 9, 2012 at 9:27
WilliamWilliam
4911 bronze badge
Add a... |
Why use your application-level cache if database already provides caching? |
Modern database provide caching support. Most of the ORM frameworks cache retrieved data too. Why this duplication is necessary?
|
Because to get the data from the database's cache, you still have to:
Generate the SQL from the ORM's "native" query format
Do a network round-trip to the database server
Parse the SQL
Fetch the data from the cache
Serialise the data to the database's over-the-wire format
Deserialize the data into the database client... |
How to clear all cached images loaded from SDWebImage? |
I have all images loaded on my app via SDWebImage. The downloading and caching works great, but I wanted to make a button that can clear all cached images in the entire app.
I have a "Clear Cache" button as a UIButton on one of my tab bar views. How can I make it so when this button is tapped, all the cached images ar... |
If you want to completely clear the cache do the following:
Obj-c:
- (IBAction)clearCache:(id)sender {
[[SDImageCache sharedImageCache]clearMemory];
[[SDImageCache sharedImageCache]clearDisk];
}
Swift 5
SDImageCache.shared.clearMemory()
SDImageCache.shared.clearDisk()
Swift 3.0
@IBAction func clearCache(send... |
How would you forget cached Eloquent models in Laravel? |
Theoretical question on Laravel here.
So Example of the caching I'd do is:
Article::with('comments')->remember(5)->get();
Ideally I'd like to have an event for Article updates that when the ID of a instance of that model (that's already cached) is updated I want to forget that key (even if it's the whole result of th... |
So i was looking for an answer to the same question as OP but was not really satisfied with the solutions. So i started playing around with this recently and going through the source code of the framework, I found out that the remember() method accepts second param called key and for some reason it has not been docume... |
Tuple vs string as a Dictionary key in C# |
I have a cache that I implement using a ConcurrentDictionary,
The data that I need to keep depends on 5 parameters.
So the Method to get it from the cache is: (I show only 3 parameters here for simplicity, and I changed the data type to represent CarData for clearity)
public CarData GetCarData(string carModel, string ... |
You could create a class (doesn't matter that its only used here) that overrides GetHashCode and Equals:
Thanks theDmi (and others) for improvements...
public class CarKey : IEquatable<CarKey>
{
public CarKey(string carModel, string engineType, int year)
{
CarModel = carModel;
EngineType= engin... |
Rails 4.0 expire_fragment/cache expiration not working |
I have been trying to use the caching capabilities of rails, but I am unable to expire some cache fragment although they seem to expire. Using the 'Russian Doll Caching' as pointed out in the rails tutorial site, I am using this configuration
<% cache "all_available_releases" do %>
<% @releases.each do |release| %>
... |
I believe the issue is that when you cache the fragment in your view, a cache digest is being added to the cache key (views/all_available_releases/41cb0a928326986f35f41c52bb3d8352), but expire_fragment is not using the digest (views/all_available_releases).
If you add skip_digest: true to the cache call in the view it... |
Android FileProvider for CACHE DIR : Failed to find configured root that contains |
I found so many links which is related to FileProvider, but I didn't found solution for cache directory
java.lang.IllegalArgumentException: Failed to find configured root
that contains /data/data/pkg name/cache/1487876607264.png
I want to use it for CACHE DIRECTORY, How can I give path in provider.
<paths>
<e... |
Use <cache-path>, not <external-path>. See the documentation.
|
Clearing ActiveRecord cache |
I'm building a command line application using ActiveRecord 3.0 (without rails). How do I clear the query cache that ActiveRecord maintains?
|
To a first approximation:
ActiveRecord::Base.connection.query_cache.clear
|
Disable autofill on a web form through HTML or JavaScript? |
Is there a way to disable autofill in Chrome and other browsers on form fields through HTML or JavaScript? I don't want the browser automatically filling in answers on the forms from previous users of the browser.
I know I can clear the cache, but I can't rely on repeatedly clearing the cache.
|
You can do it at the input level in HTML by adding autocomplete="off" to the input.
http://css-tricks.com/snippets/html/autocomplete-off/
You could also do it via JS such as:
someForm.setAttribute( "autocomplete", "off" );
someFormElm.setAttribute( "autocomplete", "off" );
|
Preventing pytest from creating .cache directories in Pycharm |
I'm using Pycharm for this years Advent of Code and I'm using pytest for testing all of the examples and output.
I'd prefer it if pytest didn't create the .cache directories throughout my directory tree. Is there anyway to disable the creation of .cache directories when tests fail?
|
There are two basic options:
disable the caching altogether (the caching is done with the cacheprovider plugin):
pytest -p no:cacheprovider
-p is used to disable plugins.
changing the cache location by tweaking the cache-dir configuration option (requires pytest 3.2+)
Sets a directory where stores content of cache ... |
why are separate icache and dcache needed [duplicate] |
This question already has an answer here:
What does a 'Split' cache means. And how is it useful(if it is)?
(1 answer)
Closed 3 years ago.
Can someone please explain what do we gain... |
The main reason is: performance. Another reason is power consumption.
Separate dCache and iCache makes it possible to fetch instructions and data in parallel.
Instructions and data have different access patterns.
Writes to iCache are rare. CPU designers are optimizing the iCache and the CPU architecture based on the a... |
Inconsistent cache values using Zend Cache with AWS ElastiCache across multiple servers |
We are using Zend Cache with a memcached backend pointing to an AWS ElastiCache cluster with 2 cache nodes. Our cache setup looks like this:
$frontend = array(
'lifetime' => (60*60*48),
'automatic_serialization' => true,
'cache_id_prefix' => $prefix
);
$backend = array(
'servers' => array(
arr... |
1
Can you tell what hash_strategy you are using for memcache? I've had problems in the past using the default standard but everything has been fine since changing to consistent:
http://php.net/manual/en/memcache.ini.php#ini.memcache.hash-strategy
Share
Improve t... |
Is there a way to change the location of pytest's .cache directory? |
I need to be able to change the location of pytest's .cache directory to the env variable, WORKSPACE. Due to server permissions out of my control, I am running into this error because my user does not have permission to write in the directory where the tests are being run from:
py.error.EACCES: [Permission denied]: op... |
31
You can prevent the creation of .cache/ by disabling the "cacheprovider" plugin:
py.test -p no:cacheprovider ...
Share
Improve this answer
Follow
edited Jul 24, 2016 at 9:34
ans... |
Which is faster/better for caching, File System or Memcached? |
I don't think it's clear to me yet, is it faster to read things from a file or from memcached? Why?
|
Memcached is faster, but the memory is limited. HDD is huge, but I/O is slow compared to memory. You should put the hottest things to memcached, and all the others can go to cache files.
(Or man up and invest some money into more memory like these guys :)
For some benchmarks see: Cache Performance Comparison (File, Me... |
docker-compose keeps using old image content |
We use our gitlab-ci to build fresh images with the latest version of our code.
These images are day to day built with the latest tag.
We tag images during the release process.
My problem is related to the latest tag.
We deploy automatically these images on servers to test our product.
However, on a test server if we ... |
According to the documentation, you can ignore data from previous volume with this:
docker-compose up -d --force-recreate --renew-anon-volumes
See https://docs.docker.com/compose/reference/up/
|
Avoid caching of the http responses |
What is the definitive solution for avoid any kind of caching of http data? We can modify the client as well as the server - so I think we can split the task between client and the server.
Client can append to each request a random parameter http://URL/path?rand=6372637263 – My feeling is that using only this way it i... |
Server-side cache control headers should look like:
Expires: Tue, 03 Jul 2001 06:00:00 GMT
Last-Modified: {now} GMT
Cache-Control: max-age=0, no-cache, must-revalidate, proxy-revalidate
Avoid rewriting URLs on the client because it pollutes caches, and causes other weird semantic issues. Furthermore:
Use one Cache-C... |
Are cache-line-ping-pong and false sharing the same? |
For my bachelor thesis I have to evaluate common problems on multicore systems.
In some books I have read about false sharing and in other books about cache-line-ping-pong. The specific problems sound very familiar, so are these the same problems but given other names?
Can someone give me names of books which discuss ... |
Summary:
False sharing and cache-line ping-ponging are related but not the same thing. False sharing can cause cache-line ping-ponging, but it is not the only possible cause since cache-line ping-ponging can also be caused by true sharing.
Details:
False sharing
False sharing occurs when different threads have data t... |
How to prevent html5 page from caching? |
I converted a plain vanilla HTML page to HMTL5/CSS3 with a responsive layout, and for security reasons (dictated by the security people) the page must never cache.
The page previously used <meta http-equiv="Pragma" content="no-cache"> and <meta http-equiv="Expires" content="-1"> to prevent the page from being cached.
... |
In the beginning of code you need to use this:
<!DOCTYPE html>
<html manifest="manifest.appcache">
...
Then create manifest.appcache with such content:
CACHE MANIFEST
# Cache manifest version 1.0
# no cache
NETWORK:
*
|
HttpRuntime.Cache[] vs Application[] |
I know that most people recommend using HttpRuntime.Cache because it has more flexibility... etc. But what if you want the object to persist in the cache for the life of the application? Is there any big downside to using the Application[] object to cache things?
|
As long as you don't abuse the application state, then I don't see a problem in using it for items that you don't want to expire.
Alternatively I would probably use a static variable near the code that uses it. That way you avoid to go through HttpApplicationState and then be forced to have a reference to System.Web i... |
Post-loading : check if an image is in the browser cache |
Short version question :
Is there navigator.mozIsLocallyAvailable equivalent function that works on all browsers, or an alternative?
Long version :)
Hi,
Here is my situation :
I want to implement an HtmlHelper extension for asp.net MVC that handle image post-loading easily (using jQuery).
So i render the page with emp... |
after some reseach, I found a solution :
The idea is to log the cached images, binding a log function on the images 'load' event.
I first thought to store sources in a cookie, but it's not reliable if the cache is cleared without the cookie. Moreover, it adds one more cookie to HTTP requests...
Then i met the magic : ... |
Create ETag filter in ASP.NET MVC |
I would like to create an ETag filter in MVC.
The problem is that I can't control the Response.OutputStream, if I was able to do that I would simply calculate the ETag according to the result stream.
I did this thing before in WCF but couldn't find any simple idea to do that in MVC.
I want to be able to write somethin... |
Thanks a lot it is exactly what I was looking for.
Just made a small fix to the ETagFilter that will handle 304 in case that the content wasn't changed
public class ETagAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
filterContext.HttpC... |
Forcing browsers to reload Silverlight xap after an update |
I have a Silverlight control packaged up and deployed to a SharePoint web part. I'm having trouble with the browser loading new versions of the control after I push an update. I'm updating the assembly and file version of my xap project, but it doesn't seem to matter. The only way to get the browser to load the new... |
This has to do with how your browser handles resource requests. Flash has similar issues and there are a couple workarounds.
Here's an article that details the issue and possible solutions.
I would suggest doing something like this:
Say you have this for your xap in your html:
<param name="source" value="ClientBin/my... |
How to force a browser to refresh a cached version of a webpage |
I have a website that because of an ill-prepared apache conf file has instructed users to cache a website URL several years into the future. As a result, when a person visits the site, they often make no attempt to even request the page. The browser just loads the HTML from cache.
This website is about to get a major... |
18
Use different URLs. If the main entry point to your website (like the main index file) is cached, then you're screwed... maybe you should register another domain name?
Share
Improve this answer
Follow
... |
What can cause a program to run much faster the second time? |
Something I've noticed when testing code I write is that long-running operations tend to run much longer the first time a program is run than on subsequent runs, sometimes by a factor of 10 or more. Obviously there's some sort of cold cache/warm cache issue here, but I can't seem to figure out what it is.
It's not the... |
13
Three things to try:
Run it in a sampling profiler, including a "cold" run (first thing after a reboot). Should usually be enough.
Check memory usage, does it grow so high (even transiently) the OS would have to swap things out of RAM to make room for your app? That alo... |
How can I use System.Web.Caching.Cache in a Console application? |
Context: .Net 3.5, C#
I'd like to have caching mechanism in my Console application.
Instead of re-inventing the wheel, I'd like to use System.Web.Caching.Cache (and that's a final decision, I can't use other caching framework, don't ask why).
However, it looks like System.Web.Caching.Cache is supposed to run only in a... |
The documentation for the Cache constructor says that it is for internal use only. To get your Cache object, call HttpRuntime.Cache rather than creating an instance via the constructor.
|
How to get the browser to cache images, with PHP? |
I'm totally new to how to cache images.
I output all images in a gallery with PHP, and want the images already shown, to be cached by the browser, so the PHP script don't have to output the same image again. All I want is the images to show up faster.
When calling an image I do like this:
<img src="showImage.php?id=60... |
If you are using php to check if the user is logged in before outputting the message, then you don't want the browser to cache the image.
The entire point of caching is to call the server once and then never call it again. If the browser caches the image, it won't call the server and your script won't run. Instead, ... |
How to call expire_fragment from Rails Observer/Model? |
I've pretty much tried everything, but it seems impossible to use
expire_fragment from models? I know you're not supposed to and it's
non-MVC, but surely there much be some way to do it.
I created a module in lib/cache_helper.rb with all my expire helpers,
within each are just a bunch of expire_fragment calls. I... |
Disclaimer: My rails is a bit rusty, but this or something like it should work
ActionController::Base.new.expire_fragment(key, options = nil)
|
Spark cache vs broadcast |
It looks like broadcast method makes a distributed copy of RDD in my cluster. On the other hand execution of cache() method simply loads data in memory.
But I do not understand how does cached RDD is distributed in the cluster.
Could you please tell me in what cases should I use rdd.cache() and rdd.broadcast() method... |
Could you please tell me in what cases should I use rdd.cache() and
rdd.broadcast() methods?
RDDs are divided into partitions. These partitions themselves act as an immutable subset of the entire RDD. When Spark executes each stage of the graph, each partition gets sent to a worker which operates on the subset of ... |
How does Guava expire entries in its CacheBuilder? |
I want to use a CacheBuilder, as recommended here:
Java time-based map/cache with expiring keys
However I don't understand when Guava knows to expire entries.
How does Guava do it and what performance cost does it incurr?
|
Guava team member here.
The Guava Cache implementation expires entries in the course of normal maintenance operations, which occur on a per-segment basis during cache write operations and occasionally during cache read operations. Entries usually aren't expired at exactly their expiration time, just because Cache mak... |
Is there a open-source off-heap cache solution for Java? |
Is there any open-source alternative for Terracotta BigMemory?
Actually I didn't even manage to find any commercial alternative. I'm interested in pure Java solution which will work inside JVM without any JNI and C-backed solution.
|
19
There is a very good cache solution named MapDB(JDBM4 formerly). It supports HashMap and TreeMap But it is only application embedded. It also support persistent file based cache.
Example for off heap cache:
DB db = DBMaker.newDirectMemoryDB().make();
ConcurrentNavigableM... |
Using redis as a cache for a mysql database |
I need to create a solution using php, with a mysql database with lots of data. My program will have many requisitions, I think that if I work with cache and an OO database, I'll have a good result, but I don't have experience.
I think for example if I cache the information that is saved in mysql in a redis database, ... |
Yes, redis is good for that. But to get the gist, there are basically two approaches to caching. Depending on whether you use a framework (and which) or not, you may have first option available in standard or with use of a plug-in:
Cache database queries, that is - selected queries and their results will be kept in r... |
What is a Warm-Up Cache? |
I am working with some multicore simulators such as GEMS or M5. In all of them there is an option to "Warm up the cache". What does that term mean?
|
The warm up is just the period of loading a set of data so that the cache gets populated with valid data. If you're doing performance testing against a system that usually has a high frequency of cache hits, without the warm up you'll get false numbers because what would normally be a cache hit in your usage scenario ... |
What is the Pragma Header? Caching pages.. and IE |
So I am sending a header in php to cache my page (this integrates into our "CDN" (contendo/akamai) as well). I always use this pragma: cache header, I've seen various examples use it as well; however, I just checked fiddler to test traffic for this .net application we developed and it says:
Legacy Pragma Header is p... |
In a very simplified form, Pragma:no-cache or Pragma:cache are now "almost" obsolete ways of passing caching instructions to client implementations, specifically browers and proxies. The way the client implementation responds to Pragma headers vary which is why the specification says it is implementation specific.
The... |
How to Leverage Browser Caching in Firebase hosting |
I have hosted my personal blog on Google's firebase. My Blog is based on jekyll. Firebase provides firebase.json file from where owner of project can modify the http header.
I have my css files https://blogprime.com/assets/css/init.css and my fonts in https://blogprime.com/assets/font/fontname.woff ( http cache contro... |
I just make my portfolio website 99/100.
Google says:
We recommend a minimum cache time of one week and preferably up to one
year for static assets.
"headers": [ {
"source" : "**/*.@(eot|otf|ttf|ttc|woff|font.css)",
"headers" : [ {
"key" : "Access-Control-Allow-Origin",
"value" : "*... |
ASP.NET MVC: Make browser cache images from action |
I have an actionmethod that returns a File and has only one argument (an id).
e.g.
public ActionResult Icon(long id)
{
return File(Server.MapPath("~/Content/Images/image" + id + ".png"), "image/png");
}
I want the browser to automatically cache this image the first time I access it so the next time it doesn't hav... |
First thing to note is that when you hit F5 (refresh) in Chrome, Safari or IE the images will be requested again, even if they've been cached in the browser.
To tell the browser that it doesn't need to download the image again you'll need to return a 304 response with no content, as per below.
Response.StatusCode = 30... |
What is the default expiry time for Rails cache? |
I've done some googling and couldn't find the answer to this question. Rails allows to specify expiry times for its cache like that:
Rails.cache.fetch("my_var", :expires_in => 10.seconds)
But what happens if I specify nothing:
Rails.cache.fetch("my_var")
It never expires? Is there a default value? How can I explicit... |
It really depends on which cache storage you're using. Rails provides several, one of them most popular is Memcached. One of key features of Memcached is that it automatically expires old unused records, so you can forget about :expire option.
Other Rails cache storages, like memory storage or redis storage will keep... |
Do I need volatile for variables of reference types, too? |
We often use volatile to ensure that a condition variable can be visible to every Thread.
I see the volatile fields are all primitive type in code so far.
Does object field has this problem? For example:
class a {
public String str;
public List list;
}
If there are some threads which will access str and list... |
35
You have to distinguish between the object reference and the actual object.
For the reference your field modifier is relevant. When you change the reference to a different object (i.e. reference a different String) the change might not be noticed by a different Thread. ... |
Set up caching on entities and relationships in Fluent Nhibernate? |
Does anyone have an example how to set up and what entities to cache in fluent nhibernate. Both using fluent mapping and auto mapping?
And the same for entity relationships, both one-to-many and many-to-many?
|
I have been working a a similar situation, where I just want to cache specific elements, and want these elements to be loaded once on start up, and kept in cache, until the application is shut down. This is a read only cache, and is used to populate a list of countries, so that a user can select their country from the... |
Is it safe to remove npm-cache folder in windows? |
npm cache clean -f is not able to clear the npm_cache folder located at the path C:\Users\jerry\AppData\Roaming\npm-cache. Though it clears some of the files in this folder.
Output of command: npm WARN I sure hope you know what you are doing.
However, Node.js page says clean command will delete all data out of the ... |
17
Yes it is safe,
I have deleted npm and npm-cache folder manually and reinstall node its working fine.
Share
Improve this answer
Follow
answered Dec 15, 2018 at 6:07
Subhajit DasSubhajit ... |
HTML5 Local Storage of audio element source - is it possible? |
I've been experimenting with the audio and local storage features of html5 of late and have run into something that has me stumped.
I'd like to be able to cache or store the source of the audio element locally to enable speedier and offline playback. The problem is I can't see how this is possible with the current im... |
So it's been a while since I asked this question and I thought i'd give some info about how we solved it. Basically we encoded the data into PNG's using a similar technique to this:
http://audioscene.org/scene-files/yury/pngencoding/sample.html
Then cached the image on the mobile device using html5 local storage and a... |
Spring cache all elements in list separately |
I'm trying to add caching to a CRUD app, I started doing something like this:
@Cacheable("users")
List<User> list() {
return userRepository.findAll()
}
@CachePut(value = "users", key = "#user.id")
void create(User user) {
userRepository.create(user)
}
@CachePut(value = "users", key = "#user.id")
void update(... |
I'll self answer my question since no one gave any and could help others.
The problem I had when dealing with this issue was a problem of misconception of Cache usage. My need posted on this question was related to how to update members of a cached list (method response). This problem cannot be solved with cache, bec... |
What's the best way to create an etag? [closed] |
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be imp... |
7
I recommend generating a hash of the the content, e.g. md5($content).
Additionally, to prevent hash collision, you might want to add e.g. the ID of the content element to it (if this is appropriate).
Share
Improve this answer
Follow
... |
nginx as cache proxy not caching anything |
I'm trying to cache static content which are basically inside the paths below in virtual server configuration. For some reason files are not being cached. I see several folders and files inside the cache dir but its always something like 20mb no higher no lower. If it were caching images for example would take at leas... |
Make sure your backend does not return Set-Cookie header. If Nginx sees it, it disables caching.
If this is your case, the best option is to fix your backend. When fixing the backend is not an option, it's possible to instruct Nginx to ignore Set-Cookie header
proxy_ignore_headers "Set-Cookie";
proxy_hide_header "Set-... |
Pagespeed caching css, annoying to develop |
I'm working on a site which I havent coded from scratch and in firebug the css files are being displayed as: style.css.pagespeed.ce.5d2Z68nynm.css with the pagespeed extension. Can anyone tell me what's doing this as I can't find it. I'm guessing mod-pagespeed possibly running on server? I want to turn it off for now ... |
According to http://code.google.com/speed/page-speed/docs/using_mod.html#htaccess
you can turn off the module with the line ModPagespeed off in a .htaccess file.
The best solution would be to have a non-live development environment that didn't have mod_pagespeed on at all, or where it could be added only for some fina... |
What does 'dirty-flag' / 'dirty-values' mean? |
I see some variables named 'dirty' in some source code at work and some other code. What does it mean? What is a dirty flag?
|
42
Generally, dirty flags are used to indicate that some data has changed and needs to eventually be written to some external destination. It isn't written immediate because adjacent data may also get changed and writing bulk of data is generally more efficient than writing... |
Difference between Cache and Translation LookAside Buffer[TLB] |
What is the difference between Cache and Translation LookAside Buffer [TLB] ?
|
From Wiki:
In computer science, a cache (pronounced /kæʃ/, kash) is a collection of data duplicating original values stored elsewhere or computed earlier, where the original data is expensive to fetch (owing to longer access time) or to compute, compared to the cost of reading the cache. In other words, a cache oper... |
IIS 7.5 remove etag headers from response |
I know this question has been asked alot of times, however most of them were in 2009-2010.
I am pretty sure a while back a project I was working on removed them, however I cannot find any way to remove them at the moment.
So has there been any advances in this field? It seems crazy that microsoft has made IIS to not b... |
You can use the IIS Rewrite Module 2.0 to remove the ETag. The following rewrite rule should do it:
<rewrite>
<outboundRules>
<rule name="Remove ETag">
<match serverVariable="RESPONSE_ETag" pattern=".+" />
<action type="Rewrite" value="" />
</rule>
</outboundRules>
</rewrite>
You c... |
Disable static file caching in Tornado |
By default, Tornado puts a Cache-Control: public header on any file served by a StaticFileHandler. How can this be changed to Cache-Control: no-cache?
|
Looking into the tornado/web.py it seems that the easiest way is to subclass the StaticFileHandler and override the set_extra_headers method.
def set_extra_headers(self, path):
self.set_header("Cache-control", "no-cache")
|
Is it the filename or the whole URL used as a key in browser caches? |
It's common to want browsers to cache resources - JavaScript, CSS, images, etc. until there is a new version available, and then ensure that the browser fetches and caches the new version instead.
One solution is to embed a version number in the resource's filename, but will placing the resources to be managed in this... |
Yes, any change in any part of the URL (excluding HTTP and HTTPS protocols changes) is interpreted as a different resource by the browser (and any intermediary proxies), and will thus result in a separate entity in the browser-cache.
Update:
The claim in this ThinkVitamin article that Opera and Safari/Webkit browsers ... |
Memcache vs APC for a single server site data caching |
I have a single server site thats pushing 200k unqiues per day, and the traffic doubles roughly every 40 days (for the last 5 months anyway).
I pretty much only plan to cache the output of mysql_query functions for an hour or so. If cache is older than that, run query, put result back into the cache for another hour.... |
A quick Googling says that APC is 5 times faster than Memcached.
My experience say that APC is nearly 7-8 times faster than Memcached.. but, memchached can be accessed by different services (for example, if you run mainly on apache and delegates some traffic, e.g. static contents like images or pure html, to another w... |
Internet Explorer cache location |
Where is cache for IE for current user located?
|
By default, the locations of Temporary Internet Files (for Internet Explorer) are:
Windows 95, Windows 98, and Windows ME
c:\WINDOWS\Temporary Internet Files
Windows 2000 and Windows XP
C:\Documents and Settings\\[User]\Local Settings\Temporary Internet Files
Windows Vista and Windows 7
%userprofile%\AppData\Local\M... |
Redis list with expiring entries? |
I'm looking for a way to store a list of items for a user, that will expire within 24 hours. Is there a way to accomplish this using Redis? I was thinking of just using the list and setting an expiration for each individual item, is there a better way?
|
NO, you CANNOT set expiration for each item in a LIST. You can only set an expiration for the entire LIST.
In order to achieve what you want, you need to have a key for each item:
SET user1:item1 value EX 86400
SET uesr1:iter2 value EX 86400
SET user2:item1 value EX 86400
To get all items of a specified user, you can... |
Get all keys from Redis Cache database |
I am using Redis cache for caching purpose (specifically stackexchange.Redis C# driver. Was wondering is there any ways to get all the keys available in cache at any point in time. I mean the similar thing I can do in ASP.NET cache object (below code sample)
var keys = Cache.GetEnumerator(); ... |
Function that you need is under IServer interface, and can be reached with:
ConnectionMultiplexer m = CreateConnection();
m.GetServer("host").Keys();
Note that prior to version 2.8 of redis server that will use KEYS command you mentioned, and it can be very slow in certain cases. However if you use redis 2.8+ - it wi... |
How to clear Facebook's image cache |
I have a Facebook application that's created several wall-posts on behalf of my users. The image in the wall posts is cached by Facebook's servers. I've replaced the original image on my server and I would like to clear Facebook's image cache so all of the other wall posts update with the new image.
What Facebook has ... |
The way to "force" facebook to clear their cache for a specific url is to use the Debugger tool.
I tried using the debugger with the url of the image and it shows the new image and not the old one, though when trying the cached link you posted the old image still appears.
I suspect that if you try to post new posts th... |
Setting an expiry date or a maximum age in the HTTP headers [duplicate] |
This question already has answers here:
How do you set the expiry date or a maximum age in the HTTP headers for static resources in IIS
(3 answers)
Closed 10 years ago.
I just fini... |
Generally that is done using the .htaccess file on your host. Here is an example cut and pasted from HTTP cache headers with .htaccess
<IfModule mod_headers.c>
# WEEK
<FilesMatch "\.(jpg|jpeg|png|gif|swf)$">
Header set Cache-Control "max-age=604800, public"
</FilesMatch>
</IfModule>
If delivering materials from a... |
ERR_CACHE_READ_FAILURE in google chrome |
more often than not, I get a list of ERR_CACHE_READ_FAILURE errors when loading a web page in google chrome - this results in assets not being loaded, images, style sheets etc.
what would be the cause of this? I have tried disabling browser extensions, clearing cache etc.
It is causing me issues when testing websites... |
25
In my case a tool called Dell SupportAssist has cleaned up browser caches by deleting their temp folder contents, meanwhile the browser had database entries to those cached files somewhere else and thought the cached data is still available.
Solution was to delete those... |
How to clear debug tool cache data? |
It seems the facebook debug tool http://developers.facebook.com/tools/debug is using a cache.
I made an update to my site but facebook debug tool is still showing up the old data.
Is their any way to force facebook to refresh its data? It has been a few days now and it seems the cache will not expire.
|
36
Go to http://developers.facebook.com/tools/debug
Enter the URL following by fbrefresh=CAN_BE_ANYTHING
Examples:
http://www.example.com?fbrefresh=CAN_BE_ANYTHING
http://www.example.com?postid=1234&fbrefresh=CAN_BE_ANYTHING
OR visit:
http://developers.facebook.com/tools... |
How to filter cached requests in chrome devtools? |
Background
Chrome devtools "Network" tab has the option to filter requests based on string-match of the URL and some predefined content type filters (CSS/JS/...). If you set a filter, the bottom bar of the network tab, contains extra information related only to the matching filter.
Question
Is it possible to filter re... |
21
You can use a filter of larger-than:1 to hide all requests that returned less than 1 byte. When I tested this, requests served from the cache have (from cache) in the size column and are excluded by this filter. Negating it showed only cache cached requests.
Granted, t... |
Can someone help me understand Guava CacheLoader? |
I'm new to Google's Guava library and am interested in Guava's Caching package. Currently I have version 10.0.1 downloaded. After reviewing the documentation, the JUnit tests source code and even after searching google extensively, I still can't figure out how to use the Caching package. The documentation is very shor... |
Guava's Cache type is generally intended to be used as a computing cache. You don't usually add values to it manually. Rather, you tell it how to load the expensive to calculate value for a key by giving it a CacheLoader that contains the necessary code.
A typical example is loading a value from a database or doing an... |
Cache-Control Headers in ASP.NET |
I am trying to set the cache-control headers for a web application (and it appears that I'm able to do it), but I am getting what I think are odd entries in the header responses. My implementation is as follows:
protected override void OnLoad(EventArgs e)
{
// Set Cacheability...
DateTime dt = ... |
23
You might also want to add this line if you are setting the max age that far out :
// Summary:
// Sets Cache-Control: public to specify that the response is cacheable
// by clients and shared (proxy) caches.
Response.Cache.SetCacheability(HttpCacheability.Public);
I... |
Java and XML (JAXP) - What about caching and thread-safety? |
I'd like to know which objects can be reused (in the same or different document) when using the Java API for XML processing, JAXP:
DocumentBuilderFactory
DocumentBuilder
XPath
Node
ErrorHandler (EDIT: I forgot that this has to be implemented in my own code, sorry)
Is it recommended to cache those objects or do the... |
Reuse
In the same thread those objects can and should be reused. For example you can use the DocumentBuilder to parse multiple documents.
Thread Safety
DocumentBuilderFactory used to explicity state it was not thread safe, I believe this is still true:
An implementation of the
DocumentBuilderFactory class is NOT
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.