문제

For how long is data stored in localStorage (as part of DOM Storage in HTML5) available? Can I set an expiration time for the data which I put into localStorage?

도움이 되었습니까?

해결책

해당 DL 목록을 그룹으로 변환 해야하는 것처럼 보입니다.이 게시물을 살펴보십시오.

http : //social.technet.microsoft.com/forums/en-us/sharepointcollaboration/thread/02F0D773-8188-4D94-A448-0C04D838B0CF

다른 팁

I would suggest to store timestamp in the object you store in the localStorage

var object = {value: "value", timestamp: new Date().getTime()}
localStorage.setItem("key", JSON.stringify(object));

You can parse the object, get the timestamp and compare with the current Date, and if necessary, update the value of the object.

var object = JSON.parse(localStorage.getItem("key")),
    dateString = object.timestamp,
    now = new Date().getTime().toString();

compareTime(dateString, now); //to implement

You can use lscache. It handles this for you automatically, including instances where the storage size exceeds the limit. If that happens, it begins pruning items that are the closest to their specified expiration.

From the readme:

lscache.set

Stores the value in localStorage. Expires after specified number of minutes.

Arguments
key (string)
value (Object|string)
time (number: optional)

This is the only real difference between the regular storage methods. Get, remove, etc work the same.

If you don't need that much functionality, you can simply store a time stamp with the value (via JSON) and check it for expiry.

Noteworthy, there's a good reason why local storage is left up to the user. But, things like lscache do come in handy when you need to store extremely temporary data.

AD 사용자는 SharePoint가 SharePoint가 그들에 대해 알게 될 때까지 SharePoint에 존재하지 않습니다 (예 : 명시 적 사용 권한 설정, 사용자가 로그인 한 등).

spweb.ensureUser (String userlogonname)를 사용해보십시오. SharePoint가 아직없는 경우 사용자를 만듭니다.

While local storage does not supply an expiration mechanism, cookies do. Simply pairing a local storage key with a cookie provides an easy way to ensure that local storage can be updated with the same expiration parameters as a cookie.

Example in jQuery:

if (!$.cookie('your_key') || !localStorage.getItem('your_key')) {
    //get your_data from server, then...
    localStorage.setItem('your_key', 'your_data' );
    $.cookie('your_key', 1);
} else {
    var your_data = localStorage.getItem('your_key');
}
// do stuff with your_data

This example sets a cookie with the default parameter to expire when the browser is closed. Thus, when the browser is closed and re-opened, the local data store for your_data gets refreshed by a server-side call.

Note that this is not exactly the same as removing the local data store, it is instead updating the local data store whenever the cookie expires. However, if your main goal is to be able to store more than 4K client-side (the limitation for cookie size), this pairing of cookie and local storage will help you to accomplish a larger storage size using the same expiration parameters as a cookie.

무료 및 공개적으로 사용 가능한 테마로, 당신은 할 수 있습니다!

테마를 직접 건설 한 경우 예, 할 수 있습니다!

테마가 GPL 라이센스 또는 완전히 공개 된 경우 예, 예, 할 수 있습니다!

그러나

테마를 구축 한 개발자의 클라이언트가 있지만 그렇게 간단하지 않을 수도 있습니다. 그것은 당신의 계약에있을 수 있으며 개발자 또는 대행사를 조달 할 때 협상해야합니다. 귀하의 디자이너 / 개발자 또는 변호사 에 문의하십시오.

테마 상점에서 주제를 구입하는 것은 의심스럽고 서비스 약관 및 계약 조건을 확인하고 의심의 여지가있는 경우 변호사 에 문의하십시오.

프리미엄 테마가 무료 라이트 버전이있는 경우 의심 스러울 수 있고 원래의 저자에게 물어보고 라이센스를 확인하고 의심의 여지가있는 경우 변호사

이는 법률 조언을위한 포럼이 아닙니다. 우리는 법적 전문가가 아닙니다. 우리는 실제로 합법적이지만 다른 경우에 우리는 견고한 법적 조언을 제공 할 수없는 경우를 알고 있습니다. 합법적 인 것도 국가에서 주에서의 변화를 변경합니다.

The lifecycle is controlled by the application/user.

From the standard:

User agents should expire data from the local storage areas only for security reasons or when requested to do so by the user. User agents should always avoid deleting data while a script that could access that data is running.

From the W3C draft:

User agents should expire data from the local storage areas only for security reasons or when requested to do so by the user. User agents should always avoid deleting data while a script that could access that data is running.

You'll want to do your updates on your schedule using setItem(key, value); that will either add or update the given key with the new data.

$this->User->create() 앞에 var_dump($this->data)를 사용하여 graduation1가 실제로 게시되었는지 확인하십시오. 테이블의 필드가 graduation1 인지 확인하십시오.

- 편집 -

단일 정수 (1 년) 만 저장하려는 경우 int를 date 대신 필드 데이터 유형으로 사용하십시오

- edit2 - cakephp가 name="data[User][graduation1][year]" try 를 생성하는 이유를 확실하지 않습니다.

$yearRanges = range(1960, date("Y"));
echo $this->Form->input('User.graduation1', array('label' => 'Year of Graduation:',
                                                             'type' => 'select',
                                                             'options' => array_combine($yearRanges, $yearRanges),
                                                             'empty' => true
                                                            )
                                      ); 
.

If someone using jStorage Plugin of jQuery the it can be add expiry with setTTL function if jStorage plugin

$.jStorage.set('myLocalVar', "some value");
$.jStorage.setTTL("myLocalVar", 24*60*60*1000); // 24 Hr.

If anyone still looking for a quick solution and don't want dependencies like jquery etc I wrote a mini lib that add expiration to local / session / custom storage, you can find it with source here:

https://github.com/RonenNess/ExpiredStorage

save_post가 너무 늦게 실행됩니다. 당신이하려는 일을하십시오.게시물 및 관련 메타 데이터가 저장된 후에 화재가 발생합니다.카테고리는이 시점에서 이미 제거되었으며 WordPress는 기록을 유지하지 않습니다.

이전에 저장 프로세스에 연결해야합니다. 입니다.

add_action(
  'pre_post_update',
  function($post_ID,$data) {
    var_dump($post_ID,$data);
    var_dump(get_the_category($post_ID));
    die;
  },
  10,2
);
.

개념 코드 만 증명, 분명히.

@sebarmeli's approach is the best in my opinion, but if you only want data to persist for the life of a session then sessionStorage is probably a better option:

This is a global object (sessionStorage) that maintains a storage area that's available for the duration of the page session. A page session lasts for as long as the browser is open and survives over page reloads and restores. Opening a page in a new tab or window will cause a new session to be initiated.

MDN: sessionStorage

2 개의 작은 평가를 만들 수 있습니다 :
1 단계
if (a 또는 b)가 워크 플로 변수에 1을 추가하십시오.
if (c 또는 d) 워크 플로 변수에 1을 추가하십시오.
2 단계
워크 플로 변수= 2 인 경우 업데이트 상태= 녹색

You can try this one.

var hours = 24; // Reset when storage is more than 24hours
var now = new Date().getTime();
var setupTime = localStorage.getItem('setupTime');
if (setupTime == null) {
     localStorage.setItem('setupTime', now)
} else {
    if(now-setupTime > hours*60*60*1000) {
         localStorage.clear()
         localStorage.setItem('setupTime', now);
    }
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top