Prompt
stringlengths
14
160
Instruction
stringlengths
18
2k
Response
stringlengths
8
2k
Does Spring @Cacheable block if accessed by more that 1 thread?
If a method marked @Cacheable takes 10 minutes to complete and two threads t1,t2 access the method. t1 accesses at time 0 (cache method is now run for first time) t2 accesses at time t1+5mins Does this mean that t2 will not access the data for approx 5 mins since t1 has already started the @Cacheable operation and it'...
If the result of the first execution hasn't been cached, the second invocation will proceed. You should understand that @Cacheable is centered around the content of the cache (and not specifically a thread's execution context [well, kind of; the cache still needs to be threadsafe]). On execution of a method, the cache...
Manually expire low level cache
I'm using the following low-level caching for the five most recent news articles in my Rails application: @recent_news = Rails.cache.fetch("recent_news", :expires_in => 1.hour) do News.order("created_at desc").limit(5) end Is there a way to keep this query cached until a new news article is created? I was thinking ...
You can manually expire the cache using the .delete method: Rails.cache.delete("recent_news")
HIbernate Entity Manager: How to cache queries?
I am using the Hibernate 3.5.1 and EntityManager for data persistence (with JPA 2.0 and EHCache 1.5). I can obtain the query by the following code: EntityManager em; ... Query query = em.createQuery(...); ... Now, the problem is that EntityManager's createQuery() method returns javax.persistence.Query which, unlike o...
You can use the unwrap method to get at the vendor implementation when you want to use vendor specific extensions. e.g., org.hibernate.Query hquery = query.unwrap(org.hibernate.Query.class); Then you can work with the vendor specific interface. Alternately you could just unwrap your EntityManager to a Session befor...
Using workbox runtime caching, requests are not showing on cache storage on chrome
I am using workbox runtime caching to cache external calls (materialize.css is one of those). In my network tab it shows that the request is coming from serviceWorker (looks fine): But on cache storage my runtime cache looks empty: You can see my service worker on chromes's application tab, and this is the website: ...
The underlying issue is that those are opaque responses, and by default, they won't be used with a cacheFirst strategy. There's some background at https://workboxjs.org/how_tos/cdn-caching.html There's logging in Workbox to help debug this sort of thing, but as it's noisy, it's not enabled by default in the production...
How Retrofit with OKHttp use cache data when offline
I want to Retrofit with OkHttp uses cache when is no Internet. I prepare OkHttpClient like this: RestAdapter.Builder builder= new RestAdapter.Builder() .setRequestInterceptor(new RequestInterceptor() { @Override public void intercept(RequestFacade request) { request.a...
I have simlar problem in my company :) The problem was on server side. In serwer response i have: Pragma: no-cache So when i removed this everything starts working. Before i removed it i get all the time such exceptions: 504 Unsatisfiable Request (only-if-cached) Ok so how implementation on my side looks. OkHttpC...
.net MemoryCache - notify on item removed
I'm using a .net Memory Cache with .NET 4.0 and c#, I want my application to be notified when an item is removed (so I can write that it has been removed to a log file or notify the UI, that the item is removed). Is there anyway to do this. I'm using System.Runtime.Caching.MemoryCache not System.Web.Caching
EDIT: If you're using the System.Runtime.Caching.MemoryCache there is a callback on the CacheItemPolicy object for deletion, as well as one for update. myMemoryCache.Set("key", null, new CacheItemPolicy() {RemovedCallback = new CacheEntryRemovedCallback(CacheRemovedCallback) /* your other parameters here */}); public...
What does the question mark at then end of a css include url do?
I've noticed that on some websites (including SO) the link to the CSS will look like: <link rel="stylesheet" href="http://sstatic.net/so/all.css?v=6638"> I would say its safe to assume that ?v=6638 tells the browser to load version 6638 of the css file. But can I do this on my websites and can I include different ve...
That loads all.css with a different query string so that if version 6637, for instance, is already cached on your machine, you'll get the new one (6638). Changing that number (in this case) will not give you a different file. This is just a cache trick so they can send the file down with no expiration (i.e. you never ...
RewriteRule checking file in rewriten file path exists
How can you use ModRewrite to check if a cache file exists, and if it does, rewrite to the cache file and otherwise rewrite to a dynamic file. For example I have the following folder structure: pages.php cache/ pages/ 1.html 2.html textToo.html etc. How would you setup the RewriteRules for this so req...
RewriteRule ^pages/([^/\.]+) cache/pages/$1.html [NC,QSA] # At this point, we would have already re-written pages/4 to cache/pages/4.html RewriteCond %{REQUEST_FILENAME} !-f # If the above RewriteCond succeeded, we don't have a cache, so rewrite to # the pages.php URI, otherwise we fall off the end and go with the ...
How to Delete Derived Data and Clean Project in Xcode 5 and later?
Is there a procedure I can follow that includes running a script in the terminal, to delete all the files under the derived data folder and reliably clean a project? Sometimes, a project's assets don't always get updated to my simulator or device. It's mostly trial and error, and when I find that an old asset made its...
It's basically a two-or-three-step process, which cleans the project of all cached assets. Of course, if anyone uses this technique, and a project still does not show updated assets, then please add an answer! It’s definitely possible that someone out there has encountered situations that require a step that I’m not i...
Best way to cache a reflection property getter / setter?
I know that Reflection can be expensive. I have a class that gets/sets to properties often, and one way I figured was to cache the reflection somehow. I'm not sure if I'm supposed to cache an expression or what to do here really. This is what I'm currently doing: typeof(T).GetProperty(propName).SetValue(obj, value, nu...
You should cache results of typeof(T).GetProperty(propName); and typeof(T).GetProperty(propName); Another possible approach is to combine PropertyInfo.GetGetMethod Method (or PropertyInfo.GetSetMethod Method for setter) with Delegate.CreateDelegate Method and invoke the resulting delegate every time you need t...
Check browser's cache for a js file
How can I check for a javascript file in user's cache. If he refreshed the page or visits the site after sometime. I need not download that js file again. Does the js files get cleaned up after a site is closed.
11 Whether a javascript file is cached depends on how your web server is setup, how the users browser is setup and also how any HTTP proxy servers between your server and the user are setup. The only bit you can control is how your server is setup. If you want the best chan...
Counter cache column in PostgreSQL
In my database I have tasks and comments tables. Each task has many comments. I'd like to create tasks.comments_count column that would be updated automatically by PostgreSQL, so I can get comments_count (and sort / filter by it) in O(1) time while selecting all tasks. I know there are language-specific solutions like...
If you want Postgres to automatically do something on the basis of an insert/update/delete - i.e. if you want this operation to trigger some other action - then you need to write a trigger. It's pretty straightforward. Simple enough that I doubt anyone would bother creating an extension (let alone a language feature) ...
Will the cache line aligned memory allocation pay off?
I just know basic ideas on aligned memory allocation. But I didn't cared much about align issue because I am not an assembly programmer, also didn't have experience with MMX/SIMD. And I think this is the one of the the premature optimizations. These days people saying more and more about cache hit, cache coherent, opt...
Most of the discussions on cache line alignment deal with high-performance computing working with many threads, and keeping scalability as close to linear as possible. In those discussions the reason for cache line alignment is to prevent a write to one data variable invalidating the cache line that also contains anot...
ASP.net Cache Absolute Expiration not working
I am storing a single integer value in HttpContext.Cache with an absolute expiration time of 5 minutes from now. However, after waiting 6 minutes (or longer), the integer value is still in the Cache (i.e. it's never removed even though the absolute expiration has passed). Here is the code I am using: public void Updat...
It turns out that this line: HttpContext.Current.Cache[remoteIp] = ((int)HttpContext.Current.Cache[remoteIp]) + 1; removes the previous value and re-inserts the value with NO absolute or sliding expiration time. In order to get around this I had to create a helper class and use it like so: public class IncrementingCa...
How to implement a custom cache provider with ASP.NET MVC
I am migrating a MonoRail application to ASP.NET MVC 1.0. In my original application I wrote a custom cache provider (a distributed cache provider using memcached). In MonoRail this task was very easy because the framework used interfaces and there is ICacheProvider that looks like this: public interface ICacheProvide...
Cache doesn't have an official abstraction or provider, but you can easily build one: http://weblogs.asp.net/zowens/archive/2008/08/04/cache-abstraction.aspx http://memcachedproviders.codeplex.com/SourceControl/changeset/view/15983#58762 ASP.NET 4.0 includes an output cache provider abstraction (AFAIK not a general ...
What data structures are commonly used for LRU caches and quickly locating objects?
I intended to implement a HashTable to locate objects quickly which is important for my application. However, I don't like the idea of scanning and potentially having to lock the entire table in order to locate which object was last accessed. Tables could be quite large. What data structures are commonly used to over...
Linked lists are good for LRU caches. For indexed lookups inside the linked list (to move the entry to the most recently used end of the linked list), use a HashTable. The least recently used entry will always be last in the linked list.
Client side caching in GWT
We have a gwt-client, which recieves quite a lot of data from our servers. Logically, i want to cache the data on the client side, sparing the server from unnecessary requests. As of today i have let it up to my models to handle the caching of data, which doesn't scale very well. It's also become a problem since diffe...
I suggest you look into gwt-presenter and the CachingDispatchAsync . It provides a single point of entry for executing remote commands and therefore a perfect opportunity for caching. A recent blog post outlines a possible approach.
How to determine total size of ASP.Net cache?
I'm using the ASP.net cache in a web project, and I'm writing a "status" page for it which shows the items in the cache, and as many statistics about the cache as I can find. Is there any way that I can get the total size (in bytes) of the cached data? The size of each item would be even better. I want to display this...
I am looking at my performance monitor and under the ASP.NET Apps v2.0.50727 category I have the following cache related counters: Cache % Machine Memory Limit Used Cache % Process Memory Limit Used There are also a lot of other cache related metrics under this category. These should be able to get you the percentage,...
Why isn't RAM as fast as registers/cache memory? [closed]
Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 12 years ago. Improve this question ...
10 Faster stuff costs more per bit. So you have a descending chain of storage, from a few registers at one end, through several levels of cache, down to RAM. Each level is bigger and slower than the one before. And all the way at the bottom you have disk. Share Im...
Is Memcache (Java) for Google App Engine a global cache?
I'm new to Google App Engine, and I've spent the last few days building an app using GAE's Memcache to store data. Based on my initial findings, it appears as though GAE's Memcache is NOT global? Let me explain further. I'm aware that different requests to GAE can potentially be served by different instances (in f...
Yes, Memcache is shared across all instances of your app.
AWS API Gateway caching ignores query parameters
I'm configuring the caching on AWS API Gateway side to improve performance of my REST API. The endpoint I'm trying to configure is using a query parameter. I already enabled caching on AWS API Gateway side but unfortunately had to find out that it's ignoring the query parameters when building the cache key. For insta...
You need to configure this option in the Gateway API panel. Choose your API and click Resources. Choose the method and see the URL Query String session. If there is no query string, add one. Mark the "caching" option of the query string. Perform the final tests and finally, deploy changes. Screenshot
How update/remove an item already cached within a collection of items
I am working with Spring and EhCache I have the following method @Override @Cacheable(value="products", key="#root.target.PRODUCTS") public Set<Product> findAll() { return new LinkedHashSet<>(this.productRepository.findAll()); } I have other methods working with @Cacheable and @CachePut and @CacheEvict. Now, imag...
Caching the collection using the caching abstraction is a duplicate of what the underlying caching system is doing. And because this is a duplicate, it turns out that you have to resort to some kind of duplications in your own code in one way or the other (the duplicate key for the set is the obvious representation of...
Caching virtual environment for gitlab-ci
I cached Pip packages using a Gitlab CI script, so that's not an issue. Now I also want to catch a Conda virtual environment, because it reduces time to setup the environment. I cached a virtual environment. Unfortunately it takes a long time at the end to cache all the venv files. I tried to cache only the $CI_PROJEC...
7 Reusing pip cache between builds is a very good idea but doing the same for the virtualenvs is a really bad idea. This is because virtualenv can easily become messed in a way that you cannot really detect at runtime. This not only happens, it happens more often than you...
How to cache reads?
I am using python/pysam to do analyze sequencing data. In its tutorial (pysam - An interface for reading and writing SAM files) for the command mate it says: 'This method is too slow for high-throughput processing. If a read needs to be processed with its mate, work from a read name sorted file or, better, cache reads...
9 Caching is a typical approach to speed up long running operations. It sacrifices memory for the sake of computational speed. Let's suppose you have a function which given a set of parameters always returns the same result. Unfortunately this function is very slow and you ...
Caches folder purged (Emptied/Cleared) automatically on iOS
I have an app that lets you download "modules" that can expand your app usage. When the user downloads a module, I fetch a ZIP file from a server and extract it to his Caches folder. (Each of these zips could be sized anywhere from 60k to 2MB). Unfortunately, there are over 300 modules available, and many of the users...
Edit: After some testing, this seems to work just fine and doesn't get purged. This isn't 100% confirmed yet, but it worked fine on our basic tests (I'll post more thorough results as they come). It seems saving the data to the app's "Application Support" folder resolves these issues, as this folder isn't purged. The ...
How to check when an item in MemoryCache will expire?
Is it possible to read the expiration time of an item in MemoryCache? I'm using the .NET System.Runtime.Caching.MemoryCache to store my configuration information for 30 min before I reload it from the database. As part of a status page I would like to show how old a specific cache item is or when it will expire. objec...
I believe that this has already been answered: How to get expiry date for cached item? If that isn't what you're looking for, consider the following: The API doesn't support getting the policy back from the retrieval of the cached item. Since you can cache any object, you could cache the policy in conjunction with th...
How to disable AMP caching from Google Search? [closed]
Closed. This question is not about programming or software development. It is not currently accepting answers. This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily use...
According to the AMP project FAQ you cannot: By using the AMP format, content producers are making the content in AMP files available to be cached by third parties. As a content producer I dislike Google adding their own URL, and branding around my content... From the consumer perspective looks like the content come...
How to cache doctrine "findOneBy()" query with cache id and cache lifetime option in Symfony 2.4?
I am working on the symfony 2.5 project with doctrine 2.4. I want to cache query result with cache id and cache time, so I can delete the cache result, whenever needed though admin. I am able to cache the query result with "createQueryBuilder()" option. Example: $this->createQueryBuilder('some_table') ...
You need to redefine every findBy* or findOneBy* function into custom repository: this is the only way as doctrine2 default behaviour doesn't take into account this situation. Is up to you, unfortunately. Also Ocramius (a Doctrine2 devel) say it here https://groups.google.com/d/msg/doctrine-user/RIeH8ZkKyEY/HnR7h2p0lC...
JVM and OS DNS Caching
I am facing a problem with JVM and DNS. Everything I'm reading (including the docs and this) says that I can disable JVM DNS caching using networkaddress.cache.ttl, which can be set using java.security.Security.setProperties, but through the standard approach of using system properties. I have successfully changed thi...
6 I think I've run into this problem, or a very similar one. What I did then was to implement my own DNS provider for the JVM, see how to change the java dns service provider for details. You can use the dnsjava mentioned there or roll your own. Share Improve this...
How can I load values from memory without polluting the cache?
I want to read a memory location without polluting the cache. I am working on X86 Linux machine. I tried using MOVNTDQA assembler instruction: asm("movntdqa %[source], %[dest] \n\t" : [dest] "=x" (my_var) : [source] "m" (my_mem[0]) : "memory"); my_mem is an int* allocated with new, my_var is an int. I have tw...
8 The problem with the movntdqa instruction with %%xmm as target (loading from memory) is that this insn is only available with SSE4.1 and on. This means newer Core 2 (45 nm) or i7 only so far. The other way around (storing data to memory) is available in earlier SSE versio...
Flush disk write cache from Windows CLI
Does anyone know how to flush the disk write cache data from the cache manager for the current directory (or any given file or directory, for that matter), from a Windows command line?
I found the SysInternals Sync worked well for me - although it flushes ALL cache, not just for the specific folder. Example of usage: IF EXIST Output RD /S /Q Output && Sync && MD Output By default it flushes all cached data for all drives - you can specify command-line options to restrict which drives but you cannot...
Laravel, using in-memory DB to cache results
On News Website, I have an Article model, and I want to cache the latest articles since I expect they have the highest hits. How can I write a method that operates in this way: public function findById($id) { if(Article::inMemory($id)) return Article::findFromMemory($id); return Article::find($id); } ...
4 Laravel has a feature explicitly for this scenario, called Retrieve Or Update: use Cache; public function findById($id) { return Cache::rememberForever("article-$id", function () use ($id) { return Article::find($id); }); } This will cache and return th...
Check memory usage in haskell
I'm creating a program which implements some kind of cache. I need to use as much memory as possible and to do that I need to do two things: Check how much memory is still available in system (RAM only, not SWAP) Check how much memory my app is already using. I need a platform independent solution (Linux, Windows, e...
4 I can't immediately see how to do this portably. However, GHC does have "weak pointers". (See System.Mem.Weak.) If you create items and hang on to them via weak pointers (only), then the garbage collector will automatically start deleting items if you run low on physical ...
How to store data in cache in symfony2
I have a configuration-table(id,name,value), containing some configuration variables for my symfony application such as email_expiration_duration. I want to write a service to read these configuration varibales from symfony application. I want cache the data in app/cache folder. That means I will read the data from da...
4 If you want to store this information in a file you manually create in the app/cache folder, you may use the following solution: https://stackoverflow.com/a/13410635/1443490 If you don't want/need to care about what folder is used inside the app/cache folder and your proj...
Nginx caching with variable param order
I am generating a cache key with nginx based on the request URI and query params that checks memcache directly and then serves the page from PHP-FPM if a cache key is not found. My problem is that many URLs have query string options that come in in varying orders and thus generated two or more separate cache keys per ...
4 if you know which parameters are important for cache key generation then you could specify their manually. Based on your example I wrote next example: set $cache_key "$uri?id=$arg_id&type=$arg_type&sort=$arg_sort&limit=$arg_limit"; Or you could use embedded perl and writ...
Prevent browser cache of angular templates
I've been researching back and fourth on this issue, which is quite simple: Modern browsers (chrome/ FF) are caching stuff, html pages among others. When you release a new version, angular GETs these templates. However since the browser serve a cache version of these pages and not the new updated version. I've read a...
2 i am using interceptors. if request includes exact chunk of url(path to templates) i set header "Cache-Control": "no-cache, must-revalidate" $httpProvider.interceptors.push(function($q,ngToast) { return { request: function(config){ if(...
Play video from cache in iphone programmatically
I am developing an iPhone application in which I will store stream video from URL directly to cache in local, now I need to play video in movie-player while it was in downloading in cache. I followed this http://lists.apple.com/archives/cocoa-dev/2011/Jun/msg00844.html, but I couldn't do exact. I am able to download v...
1 Just change your web url to local path url... Try this code... NSBundle *bundle = [NSBundle mainBundle]; NSString *moviePath = [bundle pathForResource:@"Movie" ofType:@"m4v"]; NSURL *movieURL = [[NSURL fileURLWithPath:moviePath] retain]; MPMoviePlayerController *theMo...
Hibernate not caching my OneToOne relationship on the inverse side
I have code like: @Entity @Table(name = "A") @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) public class A { @OneToOne(cascade={CascadeType.ALL}, fetch=FetchType.EAGER, mappedBy="a") public B getB() {}; } @Entity @Table(name = "B") @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) publi...
Workaround that work for me is create additional method with @OneToMany @OneToMany(cascade={}, fetch=FetchType.EAGER, mappedBy="a") public Set<B> getBSet() {}; @Transient public B getB() { return b.iterator().next(); } I'm not very happy with this solutions, but it works and I can't find other way.
Best way to cache resized images using PHP and MySQL
What would be the best practice way to handle the caching of images using PHP. The filename is currently stored in a MySQL database which is renamed to a GUID on upload, along with the original filename and alt tag. When the image is put into the HTML pages it is done so using a url such as '/images/get/200x200/{guid}...
There is two typos in Dan Udey's rewrite example (and I can't comment on it), it should rather be : RewriteCond %{REQUEST_URI} ^/images/cached/ RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f RewriteRule (.*) /images/generate.php?$1 [L] Regards.
Could not open cp_init class cache for initialization script
I am new to Android Studio and I keep getting this error. I have researched and tried deleting .gradle, closing program and restarting, checking power save mode, and Cleaning and Rerunning. Any other ideas to try would be greatly appreciated. It worked perfect last night and now I am getting this error. Error:Could no...
22 You might also be running a too-new version of Java. Downgrading to Java 1.8 via https://adoptopenjdk.net/ fixed this issue for me. See BUG! exception in phase 'semantic analysis' Share Improve this answer Follow ...
Install webapp to homescreen on iPhone?
How do I go about allowing my webapp to be installed as an icon on a user's homescreen? Is the data cached locally, so that the webapp can be run when the user is outside of 3G? I did a quick google, but my search terms were lacking. I noticed that Google Buzz allowed me to install locally, and I'm wondering what the ...
This behaviour is done with a meta tag titled apple-mobile-web-app-capable. Details (and other meta tags useful for iPhone web apps): https://developer.apple.com/library/content/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html <meta name="apple-mobile-web-app-capable" content="yes"> To se...
Workbox: the danger of self.skipWaiting()
I use Workbox to pre-cache assets required to render the app shell, including a basic version of index.html. Workbox assumes that index.html is available in cache, otherwise, page navigation fails because I have this registered in my Service Worker: workbox.routing.registerNavigationRoute('/index.html'); I also have ...
I highly recommend "The Service Worker Lifecycle" as an authoritative source of information about the different stages of a service worker's installation and updating. To summarize some info from that article, as it applies to your question: The service worker first enters the installing phase, and however many insta...
Leverage browser caching | modifying .htaccess file | - not working for javascript files
I am trying to modify my .htaccess file by specifying an expiration for resources. It has worked for images but not for javascript files. When running GTMetrix it still recommends that the javascript files need expiration. I have tried "application/javascript" and "application/x-javascript" but to no avail. Not sure...
23 Adding this will make it work. ExpiresByType text/x-javascript "access plus 1 month" ExpiresByType application/javascript "access plus 1 month" ExpiresByType application/x-javascript "access plus 1 month" Share Improve this answer ...
How do I cache a method with Ruby/Rails?
I have an expensive (time-consuming) external request to another web service I need to make, and I'd like to cache it. So I attempted to use this idiom, by putting the following in the application controller: def get_listings cache(:get_listings!) end def get_listings! return Hpricot.XML(open(xml_feed)) end When...
As nruth suggests, Rails' built-in cache store is probably what you want. Try: def get_listings Rails.cache.fetch(:listings) { get_listings! } end def get_listings! Hpricot.XML(open(xml_feed)) end fetch() retrieves the cached value for the specified key, or writes the result of the block to the cache if it doesn...
memcached expiration time
Memcached provides a cache expiration time option, which specifies how long objects are retained in the cache. Assuming all writes are through the cache I fail to understand why one would ever want to remove an object from the cache. In other words, if all write operations update the cache before the DB, then the cach...
17 Expiration times are useful when you don't need precise information, you just want it to be accurate to within a certain time. So you cache your data for (say) five minutes. When the data is needed, check the cache. If it's there, use it. If not (because it expired)...
git credential.helper=cache never forgets the password?
I want my password to be forgotten, so I have to type it again. I have setup this: git config credential.helper 'cache --timeout=600' but much later on, several days, it still remembers the password and does not ask me it again... git version 1.7.10.4 (at Ubuntu) did I run into a bug? (as I see similar questions but ...
Problem 1: "want my password to be forgotten" by git Problem 2 (implied): contradictory configuration settings Answer: git config --unset-all credential.helper git config --global --unset-all credential.helper git config --system --unset-all credential.helper Explanation: Git configuration is specified in three place...
Can i request SQL Server to cache a certain result set?
There is a certain query that is being called from an ASP .NET page. I studied the execution plan of that query in Management Studio and 87% is for a sort. I badly need the sorting or else the data displayed would be meaningless. Is there anyway that I can request SQL Server to cache a sorted results set so it will r...
In short, no: not at the SQL server end; it will of course load the data into memory if possible, and cache the execution plan - so subsequent calls may be faster, but it can't cache the results. Options: tune the plan; the sort sounds aggressive - could you perhaps denormalize some data or add an index (perhaps even...
How to implement a most-recently-used cache
What would be the best way to implement a most-recently-used cache of objects? Here are the requirements and restrictions... Objects are stored as key/value Object/Object pairs, so the interface would be a bit like Hashtable get/put A call to 'get' would mark that object as the most recently used. At any time, the le...
Java Collections provide LinkedHashMap out of the box, which is well-suited to building caches. You probably don't have this in Java ME, but you can grab the source code here: http://kickjava.com/src/java/util/LinkedHashMap.java.htm If you can't just copy-paste it, looking at it should get you started implementing on...
Django : random ordering(order_by('?')) makes additional query
Here is sample codes in django. [Case 1] views.py from sampleapp.models import SampleModel from django.core.cache import cache def get_filtered_data(): result = cache.get("result") # make cache if result not exists if not result: result = SampleModel.objects.filter(field_A="foo") cache...
.order_by performs sorting at database level. Here is an example. We store lasy queryset in var results. No query has been made yet: results = SampleModel.objects.filter(field_A="foo") Touch the results, for example, by iterating it: for r in results: # here query was send to database # ... Now, if we'll do it ...
jQuery isotope on first load doesn't work, How do I wait for all resources/images to be loaded?
I've got something I've put together using jQuery isotope here.. http://jsbin.com/eziqeq/6/edit It seems to work in general but on first load, of a new tab, the Isotope plugin is setting the height of the wrapper element to 0. If I refresh the page it does work and sets the height of the parent element based on the th...
15 You could use a plugin as suggested by mkoryak. or you could use the following: (no plugin required - jQuery only): // jQuery - Wait until images (and other resources) are loaded $(window).load(function(){ // All images, css style sheets and external resources are ...
Json is being cached incorrectly
Hy! My JS is requesting a JSON from controller to edit an existing object, a populated dropdownlist. Then, the View send the actual values from my autosuggest dropdown, to lately the new value be compared to the old one and the new values be stored. It is like a list of Persons. When I load the page, there is some pe...
This will disable caching for jQuery ajax: jQuery.ajaxSetup({ cache: false });
How can I get the expiry datetime of an HttpRuntime.Cache object?
Is it possible to get the expiry DateTime of an HttpRuntime.Cache object? If so, what would be the best approach?
I just went through the System.Web.Caching.Cache in reflector. It seems like everything that involves the expiry date is marked as internal. The only place i found public access to it, was through the Cache.Add and Cache.Insert methods. So it looks like you are out of luck, unless you want to go through reflection, wh...
Simple Java caching library or design pattern? [closed]
Closed. This question is seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. It does not meet Stack Overflow guidelines. It is not currently accepting answers. We don’t allow questions see...
Congratulations for realising that writing your own can be more trouble it initially appears! I would check out the Guava cache solution. Guava is a proven library and the caches are easily available (and configurable) via a fluent factory API. All Guava caches, loading or not, support the method get(K, Callable<V...
Dealing with concurrency issues when caching for high-traffic sites
I was asked this question in an interview: For a high traffic website, there is a method (say getItems()) that gets called frequently. To prevent going to the DB each time, the result is cached. However, thousands of users may be trying to access the cache at the same time, and so locking the resource would not be a...
The problem you were asked on the interview is the so-called Cache miss-storm - a scenario in which a lot of users trigger regeneration of the cache, hitting in this way the DB. To prevent this, first you have to set soft and hard expiration date. Lets say the hard expiration date is 1 day, and the soft 1 hour. The ha...
Cache decorator for numpy arrays
I am trying to make a cache decorator for functions with numpy array input parameters from functools import lru_cache import numpy as np from time import sleep a = np.array([1,2,3,4]) @lru_cache() def square(array): sleep(1) return array * array square(a) But numpy arrays are not hashable, TypeError ...
Your wrapper function creates a new inner() function each time you call it. And that new function object is decorated at that time, so the end result is that each time outter() is called, a new lru_cache() is created and that'll be empty. An empty cache will always have to re-calculate the value. You need to create a ...
Ruby on Rails: How to set up "find" options in order to not use cache
In Ruby on Rails you can find records from the database with this syntax: <model_name>.find_by_<field_name>() Examples: User.find_by_email('[email protected]'), User.find_by_id(1), ... Time ago, if I am not wrong, I read somewhere that you can explicitly disable caching for 'find' operations, but I can not remember h...
You can use ActiveRecord::QueryCache.uncached like this: User.find_by_email('[email protected]') User.find_by_email('[email protected]') # Will return cached result User.uncached do User.find_by_email('[email protected]') User.find_by_email('[email protected]') # Will query the database again end In a controller...
Using 'HttpContext.Current.Cache' safely
I am using Cache in a web service method like this: var pblDataList = (List<blabla>)HttpContext.Current.Cache.Get("pblDataList"); if (pblDataList == null) { var PBLData = dc.ExecuteQuery<blabla>(@"SELECT blabla"); pblDataList = PBLData.ToList(); HttpContext.Current.Cache.Add("pblDataList", pblDataList, ...
The cache object is thread-safe but HttpContext.Current will not be available from background threads. This may or may not apply to you here, it's not obvious from your code snippet whether or not you are actually using background threads, but in case you are now or decide to at some point in the future, you should k...
Changing frequency of ASP.NET cache item expiration?
I noticed that the ASP.NET cache items are inspected (and possibly removed) every 20 seconds (and oddly enough each time at HH:MM:00, HH:MM:20 and HH:MM:40). I spent about 15 minutes looking how to change this parameter without any success. I also tried to set the following in web.config, but it did not help: <cache p...
Poking around with Reflector reveals that the the interval is hardcoded. Expiry is handled by an internal CacheExpires class, whose static constructor contains _tsPerBucket = new TimeSpan(0, 0, 20); _tsPerBucket is readonly, so there can't be any configuration setting that modifies it later. The timer that will trigg...
Unable to use Spring @Cacheable and @EnableCaching
I'm trying to replace my old: @Component public interface MyEntityRepository extends JpaRepository<MyEntity, Integer> { @QueryHints({@QueryHint(name = CACHEABLE, value = "true")}) MyEntity findByName(String name); } by this: @Component public interface MyEntityRepository extends JpaRepository<MyEntity, Inte...
@herau You were right I had to name the bean ! The problem was that there were another bean "cacheManager", so finally, I didn't annotate Application, and created a configuration as: @EnableCaching @Configuration public class CacheConf{ @Bean(name = "springCM") public CacheManager cacheManager() { retu...
Disable or flush page cache on Windows
I assume Windows has a similar concept to Linux's page cache for storing in memory data from disks, like files, executables and dynamic libraries. I wonder if it is possible at all to disable such cache or to the very least to clear/flush it.
This is called Standby List under windows. You can purge it globally, or for one volume, or for one file handle. Globally You can do it using a readily available program from Microsoft Technet, by selecting Empty → Empty Standby List Programmatically, you can achieve the same thing using the undocumented NtSetSystemIn...
LRUCache in Scala?
I know Guava has an excellent caching library but I am looking for something more Scala/functional friendly where I can do things like cache.getOrElse(query, { /* expensive operation */}) . I also looked at Scalaz's Memo but that does not have lru expiration.
17 The Spray folks have a spray-caching module which uses Futures. There is a plain LRU version and a version that allows you to specify an explicit time to live, after which entries are expired automatically. The use of Futures obviously allows you to write code that does...
How is quicksort is related to cache?
I have seen many places say quicksort is good because it fits to cache-related stuff, such as said in wiki Additionally, quicksort's sequential and localized memory references work well with a cache http://en.wikipedia.org/wiki/Quicksort Could anyone give me some insight about this claim? How is quicksort related t...
quicksort changes the array inplace - in the array it is working on [unlike merge sort, for instance - which creates a different array for it]. Thus, it applies the principle of locality of reference. Cache benefits from multiple accesses to the same place in the memory, since only the first access needs to be actual...
Strategies for "Pre-Warming" an ASP.NET Cache
I have an ASP.NET MVC 3 / .NET Web Application, which is heavily data-driven, mainly around the concept of "Locations" (New York, California, etc). Anyway, we have some pretty busy database queries, which get cached after they are finished. E.g: public ICollection<Location> FindXForX(string x) { var result = _cache...
The quick and dirty way would be to fire-off a Task from Application_Start But I've found that it's nice to wrap this functionality into a bit of infrastructure so that you can create an ~/Admin/CacheInfo page to let you monitor the progress, state, and exceptions that may be in the process of loading up the cache.
Can QML caching in Qt 5.8 be disabled for a particular project?
Qt 5.8 was supposed to come with the optional use ahead of time qtquick compiler, instead it arrived with a sort-of-a-jit-compiler, a feature that's enabled by default and caches compiled QML files on disk in order to improve startup performance and reduce memory usage. The feature however arrives with serious bugs wh...
Add QML_DISABLE_DISK_CACHE (set to 1) to your environment variables. You should be able to do it inside your application via qputenv -- put it somewhere in main before loading QML content.
FIFO cache vs LRU cache
I'm really sorry for such simple question. I just want to be sure that I understand FIFO cache model correctly and I hope that someone will help me with that :) LRU cache deletes entry that was accessed least recently if the cache is full. FIFO deletes the entry that was added earlier(?) than other entries if the cach...
You are correct. Think of FIFO as cars going through a tunnel. The first car to go in the tunnel will be the first one to go out the other side. Think of the LRU cache as cleaning out the garage. You will throw away items that you have not used for a long time, and keep the ones that you use frequently. An evolutio...
Java fixed memory map
Is there a simple, efficient Map implementation that allows a limit on the memory to be used by the map. My use case is that I want to allocate dynamically most of the memory available at the time of its creation but I don't want OutOFMemoryError at any time in future. Basically, I want to use this map as a cache, but...
thanks for replies guys! As jasonmp85 pointed out LinkedHashMap has a constructor that allows access order. I missed out that bit when I looked at API docs. The implementation also looks quite efficient(see below). Combined with max size cap for each entry, that should solve my problem. I will also look closely at Sof...
difference between kernel mode and user mode caching in IIS 8.0
What is the difference between kernel mode caching and user mode caching and how to track both ?
Kernal Mode caching is essentially going to handle caching requests at the OS-level, so contents that are stored in it can be accessed without ever going down the rest of the usual pipeline (i.e. it will not have to go down to the ASP.NET or IIS-level caches to check for the contents) : So the request hits the initi...
Memcached, Redis, or Couchbase [closed]
Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 4 years ago. ...
Supposing there is a unique server running nginx + php + mysql instances with some remaining free RAM, the easiest way to use that RAM to cache data is simply to increase the buffer caches of the mysql instances. Databases already use LRU-like mechanisms to handle their buffers. Now, if you need to move part of the pr...
Servlet filter for browser caching?
Does anyone know how to go about coding a servlet filter that will set cache headers on a response for a given file/content type? I've got an app that serves up a lot of images, and I'd like to cut down on bandwidth for hosting it by having the browser cache the ones that don't change very often. Ideally, I'd like t...
In your filter have this line: chain.doFilter(httpRequest, new AddExpiresHeaderResponse(httpResponse)); Where the response wrapper looks like: class AddExpiresHeaderResponse extends HttpServletResponseWrapper { public static final String[] CACHEABLE_CONTENT_TYPES = new String[] { "text/css", "text/javasc...
Git-SVN clear auth-cache
How do I get git-svn to forget the svn authentication details ? We have a pairing machine running windows server 2008 on which we have a git repo and we check-in to a central subversion repository. I want git to prompt me for my subversion authentication details each time I check-in. I have removed the subversion file...
Clear the svn authentication from %HOMEPATH%\.subversion\auth\svn.simple. This resets svn authentication and git prompts for a username the next time . Note that earlier I deleted the authentication from under %appdata%\subversion\auth\svn.simple and that did not work.
Are the .js files being cached?
I recently made a website and I made a change to a .js file, but when I delete the .js file from the FTP server and upload the new one, the new file doesn't show up on the website. I checked the source code behind the .js file on the website and it's not right, it's showing the source for the old file, not the new one...
I am not positive that no-cache meta tag is the way to go. It negates all caching and kind defeats the purpose of quickly accessible pages. Also, AFAIK, meta tag works per page, so if you have a page without it that references your JS - it will be cached. The widely acceptable way of preventing JS files (and, again, C...
Browser Caching in ASP.NET application
Any suggestions on how to do browser caching within a asp.net application. I've found some different methods online but wasn't sure what would be the best. Specifically, I would like to cache my CSS and JS files. They do change, however, it is usually once a month at the most.
Another technique is to stores you static images, css and js on another server (such as a CDN) which has the Expires header set properly. The advantage of this is two-fold: The expires header will encourage browsers and proxies to cache these static files The CDN will offload from your server serving up static files....
Disable template caching in AngularJS with ui-router
I have noticed that from time to time I'll make a change to one of the templates within my AngularJS application and that at runtime, the change won't be visible. Rather, I'll have to refresh the application and if that fails, go to the path of the template itself and refresh it in order to see this change. What's the...
You can use a decorator and update UI Router's $templateFactory service to append a suffix to templateUrl function configureTemplateFactory($provide) { // Set a suffix outside the decorator function var cacheBuster = Date.now().toString(); function templateFactoryDecorator($delegate) { var fromU...
Where should caching occur in an ASP.NET MVC application?
I'm needing to cache some data using System.Web.Caching.Cache. Not sure if it matters, but the data does not come from a database, but a plethora of custom objects. The ASP.NET MVC is fairly new to me and I'm wondering where it makes sense for this caching to occur? Model or Controller? At some level this makes sense ...
I think it ultimately depends on what you are caching. If you want to cache the result of rendered pages, that is tightly coupled to the Http nature of the request, and would suggest a ActionFilter level caching mechanism. If, on the other hand, you want to cache the data that drives the pages themselves, then you sh...
QML Loader not shows changes on .qml file
I have main.qml and dynamic.qml files that i want to load dynamic.qml on main.qml using Loader {}. Content of dynamic.qml file is dynamic and another program may change its content and overwrite it. So i wrote some C++ code for detecting changes on file and fires Signal. My problem is that I don't know how can i forc...
You need to call trimComponentCache() on QQmlEngine after you have set the Loaders source property to an empty string. In other words: helpLoader.source = ""; // call trimComponentCache() here!!! helpLoader.source = "../dynamic.qml"; In order to do that, you'll need to expose some C++ object to QML which has a refere...
Clear Application cache on exit in android
What I want to do is to clear the cache memory of application on exit of application. this task i can do manually by this steps. < Apps --> Manage Apps --> "My App" --> Clear Cache>> but i wants to do this task by programming on exit of application.. please help me guys.. Thanks in advance..
14 To clear Application Data Please Try this way. I think it help you. public void clearApplicationData() { File cache = getCacheDir(); File appDir = new File(cache.getParent()); if (appDir.exists()) { String[] children = appDir.list(); for (S...
When to use Java Cache and how it differs from HashMap?
I've gone through javax.cache.Cache to understand it's usage and behavior. It's stated that, JCache is a Map-like data structure that provides temporary storage of application data. JCache and HashMap stores the elements in the local Heap memory and don't have persistence behavior by default. By implementing custo...
14 Caches usually have more management logic than a map, which are nothing else but a more or less simple datastructure. Some concepts, JCaches may implement Expiration: Entries may expire and get removed from the cache after a certain period of time or since last use Evic...
Why are connections to Azure Redis Cache so high?
I am using the Azure Redis Cache in a scenario of high load for a single machine querying the cache. This machine roughly gets and sets about 20 items per second. During daytime this increases, during nighttime this is less. So far, things have been working fine. Today I realized that the metric of "Connected Clients"...
StackExchange.Redis had a race condition that could lead to leaked connections under some conditions. This has been fixed in build 1.0.333 or newer. If you want to confirm this is the issue you are hitting, get a crash dump of your client application and look at the objects on the heap in a debugger. Look for a la...
The most simple way to cache MySQL query results using PHP?
Each time someone lands in my page list.php?id=xxxxx it requeries some MySQL queries to return this: $ids = array(..,..,..); // not big array - not longer then 50 number records $thumbs = array(..,..,..); // not big array - not longer then 50 text records $artdesc = "some text not very long"; // text field Because th...
10 Caching a PHP array is pretty easy: file_put_contents($path, '<?php return '.var_export($my_array,true).';?>'); Then you can read it back out: if (file_exists($path)) $my_array = include($path); You might also want to look into ADOdb, which provides caching internall...
C - fastest method to swap two memory blocks of equal size?
What is the fastest way to swap two non-overlapping memory areas of equal size? Say, I need to swap (t_Some *a) with (t_Some *b). Considering space-time trade-off, will increased temporary space improve the speed? For example, (char *tmp) vs (int *tmp)? I am looking for a portable solution. Prototype: void swap_elemen...
Your best bet is to maximize registers usage so that when you read a temporary you don't end up with extra (likely cached) memory accesses. Number of registers will depend on a system and registers allocation (the logic that maps your variables onto actual registers) will depend on a compiler. So your best bet is I gu...
CMake override cached variable using command line
As I understand it, when you provide a variable via the command line with cmake (e.g. -DMy_Var=ON), that variable is stored inside the cache. When that variable is then accessed on future runs of the CMake script, it will always get the value stored inside the cache, ignoring any subsequent -DMy_Var=OFF parameters on ...
9 I found two methods for changing CMake variables. The first one is suggested in the previous answer: cmake -U My_Var -D Mu_Var=new_value The second approach (I like it some more) is using CMake internal variables. In that case your variables will be still in the CMake ca...
Is it OK to include external files in cache-manifest?
I'm building an offline web application and want to use cache-manifest. Currently my cache-manifest looks like this: CACHE MANIFEST # Change the version number below each time we update a resource. # Rev 1 index.html photo.html js/photo.js css/photo.css http://code.jquery.com/jquery-1.6.1.min.js http://code.jquery.com...
19 Yes. Actually, you must include external images in your manifest, or some browsers will not load them at all even if a network connection is available! (Unless you provide a NETWORK section, which may cause the images to be fetched every time, bypassing the regular brows...
Max size iPad / iPhone Offline Application Cache
Anyone knows the max size of Safari's 'Offline Application Cache' on the iPad & iPhone. Looks like it's 5MB. Is there any way to enlarge this size? Offline application cache docs: https://developer.apple.com/library/archive/documentation/iPhone/Conceptual/SafariJSDatabaseGuide/OfflineApplicationCache/OfflineApplicatio...
9 I have the same problem on iPhone. On iPad though I figured a turn around. If your manifest contains files less than 5MB the first time and you update the cache by window.applicationCache.update() and before doing the update you increase the manifest files to be below 10m...
React to 303 status code in jquery ( Prevent from redirecting)
when I send requests to a certain server, a 303 response will come, followed by the requested response in combination with a 200 status code. Funny thing is that I only see this on my developer console's network view. When checking the statuscode and response of my $.ajax() request, there will be the response of the s...
Responses in the 300 range are meant to be transparent. AFAIK, web browsers don't expose any of them to javascript. Thus, handling the 303 is not an option. Have you tried setting the cache property to false in the ajaxSetup? It will append a timestamp to the request, preventing the browser from caching the respons...
Permanent browser cache using ServiceWorker
I am designing a JavaScript secure loader. The loader is inlined in the index.html. The goal of the secure loader is to only load JavaScript resources are trusted. The contents of index.html are mostly limited to the secure loader. For security purposes, I want index.html (as stored in cache) to never change, even if ...
4 +100 in chrome you can use FileSystem API http://www.noupe.com/design/html5-filesystem-api-create-files-store-locally-using-javascript-webkit.html this allows you to then save and read files from a sand-boxed file-system though the browse...
How to know if NSURLSessionDataTask response came from cache?
I would like to determine if the response from NSURLSessionDataTask came from cache, or was served from server I'am creating my NSURLSessionDataTask from request.cachePolicy = NSURLRequestUseProtocolCachePolicy;
Two easy options come to mind: Call [[NSURLCache sharedURLCache] cachedResponseForRequest:request] before you make the request, store the cached response, then do that again after you finish receiving data, and compare the two cached responses to see if they are the same. Make an initial request with the NSURLRequest...
Best way to cache data
I am in the process of figuring out a cache strategy for our current setup, currently have multiple web servers and wanted to know what is the best way to cache data in this environment. I have done research about MemCache and the native asp.net caching but wanted to get some feedback first. Should I go with a Linux b...
4 What about checking out Microsoft Velocity? Another option if you don't want to start using Microsoft CTP-ware is to check out Nache which allows distributed cache/session state management Share Improve this answer Follow ...
Set persistence strategy to "localTempSwap" in EHCache 3.x
In EHCache 3.1.3 The 2.x API to set the persistence strategy is missing, for instance the enum net.sf.ehcache.config.PersistenceConfiguration.Strategy is no longer in the lib. I've read the docs (for version 3.1). but I couldn't find anything about how to configure the persistence strategy, so I suppose that in versio...
When configuring the disk tier in Ehcache 3.x there is a boolean value that indicates persistence: true: data will be preserved between JVM restarts if the CacheManager or UserManagedCache has been shut down properly using one of the close methods, false: data will not be preserved between JVM restarts although the d...
Best Practice to manage all asset caching (images, css, js, everything)
I'm working on a moderately-sized web application and trying to come up with the best solution to make all browsers use the cache and only invalidate it when there is an update to the asset being loaded. According to the research I've done here and elsewhere, everyone seems to be in agreement that appending a ?v={vers...
Found what I believe to be an acceptable solution at How to force browser to reload cached CSS/JS files? No idea how I missed this in my original investigation. For anyone who comes to this question, note I'm referring to the first answer on the linked page that references Google's mod_pagespeed plugin for apache. Th...
Caching pipenv / Pipfile dependencies on TravisCI
The Travis documentation on caching does not specifically mention how to cache python dependencies installed from pipenv's Pipfile, rather than from pip's usual requirements.txt. I tried setting up pip caching per documentation anyway, but build times are not improved at all, and I see pipenv installing its deps on ev...
7 Check the documentation at https://pipenv.readthedocs.io/en/latest/advanced/ You can use the environment variable PIPENV_CACHE_DIR to tell pipenv where to cache files, then include that in the cache.directories array. I do this on my gitlab-ci.yml configuration (very simi...
jQuery clear cache on logout
When users logout from my mobile app, how can I make sure the cache is cleared? What I'm thinking about is to redirect /logout to a specific page that clears the cache and redirects to the front page, but how do I clear everything from the cache? I'm using jQuery Mobile 1.0b2pre.
Here's how I solved it: My /logout action where the users session is destroyed in the backend redirects to /exit which has an id attribute of exitPage. In my JavaScript I have asked jQuery Mobile to trigger when that page is about to be created. I then empty the DOM and redirects to the front page. /exit: <div data-ro...
Streaming output to a file and the browser
So, I'm looking for something more efficient than this: <?php ob_start(); include 'test.php'; $content = ob_get_contents(); file_put_contents('test.html', $content); echo $content; ?> The problems with the above: Client doesn't receive anything until the entire page is rendered File might be enormous, so I'd rathe...
6 Interesting problem; don't think I've tried to solve this before. I'm thinking you'll need to have a second request going from your front-facing PHP script to your server. This could be a simple call to http://localhost/test.php. If you use fopen-wrappers, you could u...
Is it safe to reinsert the entry from Guava RemovalListener?
I've got a Guava Cache (or rather, I am migrating from MapMaker to Cache) and the values represent long-running jobs. I'd like to add expireAfterAccess behavior to the cache, as it's the best way to clean it up; however, the job may still be running even though it hasn't been accessed via the cache in some time, and ...
I am not completely clear on the exact problem but another solution would be to have a Cache with softValues() instead of a maximum size or expiry time. Every time you access the cache value (in your example, start the computation), you should maintain state somewhere else with a strong reference to this value. This w...
Ubuntu - alternative to Acronis True Image
I'm considering switching from Windows 7 to Ubuntu 13.04. On Windows, I'm using Acronis True Image 2012 for Backup, which has these three key features for me: Backup system partition and recover it via bootable CD (protects me from OS damage, I could be back and running with all my programs and settings in just one h...
There is nice comparison of some commonly used backup utilities on community wiki. I'd recommend Bacula.
Heroku - how to pull data from one database and put it to another one?
We have 2 Heroku apps - the first one is production and the second one is staging. I would like to pull data from one table from the production app (it's table users with all user's data) and push it to the staging database. After a little research I found the addon called pgbackups - I have just a few concerns: Does ...
1 There are ways to do this in straight SQL. If you're comfortable with that, go for it. This way is for devs comfortable in Rails -- so we pull data out using JSON, and create users with a new ID in the new database from that JSON. Since you're pulling only 1 table, AND y...
how to dump part of fields of a special table under postgresql 8.1
how to dump part of fields of a special table under postgresql 8.1. command 'pg_dump' ? or some commands else? could you please help with this. Thanks in advance!
2 Use COPY. With your ancient Postgres 8.1 you can't use a VIEW or a SELECT. But you can specify columns to export. COPY in modern Postgres can do a lot more. You really should be upgrading to a current version. Postgres 8.1 has been unsupported since 2010. Share ...
SQL Server 2012 : getting a list of available backups
I have a client - server desktop application (.NET) and client have to get list of available backup files stored in default back up folder (C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Backup) I decided to create a stored procedure which will return table with all needed files: CREATE PROCEDURE [dbo...
It's to do with the way you pass the filepath to xp_dirtree, the only way I could get it working was with a temp table and dynamic SQL, like so: CREATE PROCEDURE [dbo].[spGetBackUpFiles] AS SET NOCOUNT ON BEGIN IF OBJECT_ID('tempdb..#table') IS NOT NULL DROP TABLE #table CREATE ...
incremental export and import postgresql C#
I have a PostgreSQL Database, with one table. Each day, I want to export the data WHERE date='whatever' so it ONLY dump the data I've managed TODAY. Then, I go to another Database, and import that DUMP file, but instead of overwrite what I already had, I want to append to it... I'm trying to do this on a C# Console AP...
2 Don't do it this way. Use one of the existing well-maintained solutions for the purpose, like Bucardo, Londiste, Slony-I, etc. See replication on the Pg wiki. Londiste at least can cope with being stopped, then resumed when you want it to catch up, so you can run it as a ...
Backup core data with RestKit 0.20
I am fairly new to RestKit and in general with synching core data with a RESTful web service. To simplify this I have decided to use RestKit for only backing up the local store to our rails backend. So here are two questions that are currently on top of my list: 1) What is the best practice for using RestKit to backup...
Directly from Blake the creator of RestKit ! ​ Short answer: there is no ready solution for sync with RestKit (when offline) but Blake points at a small but very interesting starting point - if you have any other idea please feel free to suggest. I am still looking for the best way to do this.​ Blake Watters: I've ne...
what is the difference between backup database and script it saving schema and data?
When I want to restore a database I think that the best option is to create a backup of the database. However, I can create a script that saves schema and database, save primary keys, foreign keys, triggers, indexes... In this case of script the result is the same as restore's ? I ask this because the script has a siz...
You can see Full Database Backup at msdn. The primary difference is that the transaction log is backed up. This provides you with many options such as differential backups that will eventually lead to less space needed in your drives to store your data. In addition, using the backup schemes will provide you with easie...