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
171
votes
7 answers

Android Room - Get the id of new inserted row with auto-generate

This is how I am inserting data into database using Room Persistence Library: Entity: @Entity class User { @PrimaryKey(autoGenerate = true) public int id; //... } Data access object: @Dao public interface UserDao{ @Insert(onConflict…
SpiralDev
  • 5,381
  • 4
  • 23
  • 32
107
votes
5 answers

How persistent is localStorage?

I'm depending heavily on localStorage for a plugin I'm writing. All the user settings are stored in it. Some settings require the user the write regex'es and they would be sad if their regex rules are gone at some point. So now I am wondering just…
PeeHaa
  • 66,697
  • 53
  • 182
  • 254
105
votes
1 answer

pod has unbound PersistentVolumeClaims

When I push my deployments, for some reason, I'm getting the error on my pods: pod has unbound PersistentVolumeClaims Here are my YAML below: This is running locally, not on any cloud solution. apiVersion: extensions/v1beta1 kind:…
soniccool
  • 4,688
  • 19
  • 54
  • 89
103
votes
4 answers

Persist variables between page loads

I am trying to capture the submit button press of my form and if the form is submitted, the page refreshes and I show a few hidden fields. I would like to capture whether the form has been submitted before or not and if it submitted on reload, I…
Neophile
  • 5,132
  • 14
  • 48
  • 99
24
votes
3 answers

Where is kube-apiserver located

Base question: When I try to use kube-apiserver on my master node, I get command not found error. How I can install/configure kube-apiserver? Any link to example will help. $ kube-apiserver --enable-admission-plugins DefaultStorageClass -bash:…
raj_arni
  • 809
  • 2
  • 13
  • 27
24
votes
5 answers

C# .NET - method to store some very small scale persistent information?

I have an application that will need extremely little persistent storage. Realistically, we're talking about < 30 integers. All the application needs is to know those integers on next startup (and the integers do change as it runs). A database is…
John Humphreys - w00te
  • 32,140
  • 30
  • 125
  • 230
23
votes
1 answer

Volume mount when setting up Wordpress with docker

Quickstart: Compose and WordPress proposes the following docker-compose.yml version: '3.3' services: db: image: mysql:5.7 volumes: - dbdata:/var/lib/mysql restart: always environment: MYSQL_ROOT_PASSWORD:…
tgogos
  • 16,343
  • 14
  • 77
  • 108
22
votes
4 answers

How do I move a docker container's image to a persistent disk?

We have noticed that our containers are taking up a lot of space, one of the reasons for this is the images. We would like to move the images. I know right now they are stored in /var/lib/docker/graph//layer Is there a way to move these to…
dvaini
  • 233
  • 1
  • 2
  • 5
18
votes
2 answers

Simple persistent storage in Swift

I have an array of objects each with a number of properties. Here is some sample data taken by looping through the array of objects: Name = Rent Default Value 750 This Months Estimate = 750 Sum Of This Months Actuals = 0 Risk Factor = 0.0 Monthly…
17
votes
1 answer

How long does a Blob persist?

I'm trying to write a fail-safe program that uses the canvas to draw very large images (60 MB is probably the upper range, while 10 MB is the lower range). I have discovered long ago that calling the canvas's synchronous function toDataURL usually…
Patrick Roberts
  • 40,065
  • 5
  • 74
  • 116
14
votes
2 answers

File reading performance on smartphones: internal storage vs. SD card vs. PC hard disk

My Android application will use big and very big files (i.e. between the size of 10MB and 2GB). I've always been wondering about what hardware is used by smartphones for stable storage, and whether the software (file reading/seeking) considerations…
Thomas Calc
  • 2,874
  • 2
  • 27
  • 53
12
votes
7 answers

Is it possible to save persistent objects to the file system

I'd like to save persistent objects to the file system using Hibernate without the need for a SQL database. Is this possible?
Ben Crowhurst
  • 7,042
  • 5
  • 40
  • 72
11
votes
3 answers

How to disable WAL journal mode

https://developer.apple.com/library/ios/releasenotes/DataManagement/WhatsNew_CoreData_iOS/ I am having trouble in disabling journal mode. My code is: static NSManagedObjectContext *managedObjectContext(){ static NSManagedObjectContext *context =…
user2512523
  • 989
  • 2
  • 11
  • 23
10
votes
1 answer

How do I control a kubernetes PersistentVolumeClaim to bind to a specific PersistentVolume?

I have multiple volumes and one claim. How can I tell the claim to which volume to bind to? How does a PersistentVolumeClaim know to which volume to bind? Can I controls this using some other parameters or metadata? I have the following…
Gabriel Petrovay
  • 17,013
  • 19
  • 79
  • 142
9
votes
1 answer

Apple - how to persists data in TestFlight to production for my testers?

I asked this in the Apple forum however there have been no replies. I use SQLite database in my app. The data that is in my testers local db on the device. How do I get that data for my testers into their production version of the app after they…
justdan0227
  • 1,138
  • 14
  • 38
1
2 3
30 31