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.

476 questions
229
votes
8 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
  • 7,011
  • 5
  • 28
  • 42
167
votes
6 answers

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
  • 5,790
  • 22
  • 60
  • 98
120
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
  • 71,436
  • 58
  • 190
  • 262
117
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,660
  • 14
  • 61
  • 107
36
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
  • 959
  • 2
  • 15
  • 29
30
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
  • 23,218
  • 20
  • 96
  • 128
27
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
  • 283
  • 1
  • 3
  • 5
26
votes
7 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
  • 37,047
  • 37
  • 155
  • 255
24
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
  • 49,224
  • 10
  • 102
  • 153
20
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…
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,994
  • 3
  • 30
  • 56
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
  • 8,204
  • 6
  • 48
  • 78
12
votes
3 answers

How to pre-populate a ReadOnlyMany Persistent Volume

I am trying to create a deployment in GKE that uses multiple replicas. I have some static data which I want to have available in every pod. This data will not be updated, no write is required. I decided to use a PV with a corresponding PVC with the…
11
votes
1 answer

Does Kubernetes support persistent volumes shared between multiple nodes in a cluster?

I need to build an application that has many bare-metal nodes joined in a Kubernetes cluster and I need a shared persistent file system between those nodes. The nodes should be able to read-write in this file system simultaneously. Bonus: is there a…
Michael Pacheco
  • 948
  • 1
  • 17
  • 25
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
  • 1,229
  • 2
  • 15
  • 25
1
2 3
31 32