Questions tagged [persistent-storage]

Persistent storage describes a mechanism that preserves the value of data over the lifetime of an executed script or program.

Persistent Storage in JavaScript

The persistent storage or "Web Storage" mechanism has been introduced with the draft of the HTML5 standard. JavaScript provides two different objects for this purpose:

  • sessionStorage

    The values saved to the sessionStorage object are valid for the length of a browsing session. They are only accessible from the browser (or tab) that initially stored the data. Access is not limited to pages of the same domain.

  • localStorage

    The values saved to the localStorage object are valid until explicitly removed via JavaScript. The localStorage object is unique to each domain.

Usage

A Web Storage object can only save strings. If it is required to save non-string data, the best approach is to use the JSON.stringify() function.

The two most important functions are getItem and setItem. In order to write a value to the session storage, the following action has to be taken:

sessionStorage.setItem("myKey", "myValue");

To read the just-saved value, the following action is required:

sessionStorage.getItem("test");

Further objects and methods provided by the Web Storage are described here:

Compatibility

Most modern browsers support Web Storage nowadays.
A fallback solution that is able to use Cookies if no Web Storage is available is Lawnchair

Persistent Storage in other languages

Languages like Android-Java, Python or VBA also provide mechanisms to preserve the values of certain variables over the lifetime of the program.

463 questions
5
votes
1 answer

Postgres in Docker persistent data

I'm running postgres inside a docker container to limit the amount of system resources it has access to. I'm having some trouble understanding how to make the data persistent. I've read the following…
Andy
  • 2,374
  • 4
  • 27
  • 46
5
votes
1 answer

UIWebView ignoring disk cache?

In my hybrid app I name web resource for instance main.css?{timestamp-file-was-modified} and give them a year-long max-age cache header so that the clients should keep it more or less forever. What seems to happen in my iOS app is, however, that the…
andrrs
  • 2,199
  • 3
  • 15
  • 24
5
votes
2 answers

Persistent storage on Elastic Beanstalk

How can i attach persistent storage on Elastic Beanstalk ? I know i need to have a .config file where i set the parameters of the environment to run every time an instance is created. My goal is to have a volume, let's say 100GB, that even if the…
5
votes
3 answers

Why use normal attributes (attribute.set[..]) in chef?

I'm working on a chef implementation where sometimes in the past attribute.set has been used where attribute.default would have done. In order to untangle this I've become pretty comfortable with the Chef attribute precedence paradigm. I understand…
5
votes
4 answers

Persistent Blocking Queue in Java?

TL;DR; I need to know if there's a lib with persistent blocking queue that performatic. I hava a classic producer/consumers program. They share a LinkedBlockingQueue to share the data, and I use BlockingQueue#take method in the Consumers, as I need…
Caesar Ralf
  • 2,172
  • 1
  • 16
  • 35
4
votes
1 answer

-[NSCFDictionary initWithObjects:forKeys:count:]: attempt to insert nil value at objects[0] (key: sourceRelationship)

I am having a pretty bad night with this one. I have been running and testing my code on iOS 5.0 since I had to quickly update.. I had installation problems so 4.3 Simulator wasn't available to me until just recently. I (thought I had) worked out…
SAHM
  • 3,747
  • 4
  • 37
  • 77
4
votes
1 answer

PWA persistent storage best practice

What is best practice for a PWA to store user generated data in a persistent way? My app lets the user generate up to 5 MB of data that needs to be stored and accessed locally, but also backed up regularly in case the device gets damaged/lost, or…
4
votes
6 answers

How to persist data between executions in Python

I am working on a personal project in Python where I need some form of persistent data. The data would fit in 2-3 tables of 10-20 columns and 100-200 records each. I have a basic understanding of SQL, so a database seems to make some sense. I am…
astay13
  • 6,137
  • 8
  • 36
  • 52
4
votes
1 answer

Quasar Framework - What is the safest way to store local persistent data (for Web, Cordova & Electron platforms)?

What is the safest way to store data offline, assuming that I want to cover all platforms (Web, Electron & Cordova). The reason I ask is, my app Fudget (which is a Cordova / Electron - but not Quasar) uses WebSQL to store the user's app data…
4
votes
2 answers

How to create a variable whose value persists across file reload?

Common Lisp has defvar which creates a global variable but only sets it if it is new: if it already exists, it is not reset. This is useful when reloading a file from a long running interactive process, because it keeps the data. I want the same in…
sds
  • 52,616
  • 20
  • 134
  • 226
4
votes
1 answer

StatefulSet behavior when a node dies/gets restarted and has a PersistentVolume

Suppose I have a resource foo which is a statefulset with 3 replicas. Each makes a persistent volume claim. One of the foo pods (foo-1) dies, and a new one starts in its place. Will foo-1 be bound to the same persistent volume that the previous…
4
votes
1 answer

Does navigator.webkitPersistentStorage.requestQuota apply to IndexedDB?

With today's latest version of Chrome for Android, can I request for persistent IndexedDB storage with navigator.webkitPersistentStorage.requestQuota? var requestedBytes = 1024*1024*1024; navigator.webkitPersistentStorage.requestQuota ( …
4
votes
1 answer

Persistent storage in IntelliJ plugin

I am developing an IntelliJ plugin, and I would like to store some settings information as a string. How am I able to store it? I found that PersistentStateComponent is for this purpose, but I didn't find any working and simple use of this…
4
votes
2 answers

Circular dependencies between generic types (CollectionType and its Index/Generator, e.g.)

Given a struct-based generic CollectionType … struct MyCollection: CollectionType, MyProtocol { typealias Index = MyIndex subscript(i: Index) -> Element { … } func generate() -> IndexingGenerator { …
Regexident
  • 29,108
  • 10
  • 91
  • 98
4
votes
5 answers

Write Java objects to file

Is it possible to write objects in Java to a binary file? The objects I want to write would be 2 arrays of String objects. The reason I want to do this is to save persistent data. If there is some easier way to do this let me know.
Mark Szymanski
  • 50,182
  • 22
  • 66
  • 87
1 2
3
30 31