Apple Event: May 7th at 7 am PT

Can data be retrieved from 'swaps' or 'cache'?

I am wondering whether TextEdit data I lost when I closed a document using 'revert changes' would (or might) still be in 'swaps' or 'cache' -- ?


If so, is there a way to retrieve it?


Posted on Apr 23, 2024 11:52 PM

Reply
Question marked as Best reply

Posted on Apr 24, 2024 6:39 AM

One you initially save a document in TextEdit, two things commence: 1) autosave and 2) versioning. When using the Revert To > Browse All Versions… you see each past version of the document between occurrences of autosave.


Let's say I create a new RTF TextEdit document, enter the word "cat" and then save it as some.rtf to my Desktop. Afterward, I enter a space and the word "dog". When I browse all versions, I will see the first version with the word "cat" in it and the next version with "cat dog." If I were to Restore the first version, it would overwrite the last document and I would see just "cat."


Closing a TextEdit document without ever saving it will lose everything that was entered and TextEdit, not unlike Pages, will destroy all evidence of any entered text. There won't be any temporary files to be found.


If you open a TextEdit document with previous text in it, autosave is inherited and any content entered is autosaved, even if you close the document and exit TextEdit.


Nothing is stored in the System Cache by TextEdit. Each sandboxed Apple application saves its current application state in data files within its own ~/Library/Containers folder hierarchy.

6 replies
Question marked as Best reply

Apr 24, 2024 6:39 AM in response to ddow77

One you initially save a document in TextEdit, two things commence: 1) autosave and 2) versioning. When using the Revert To > Browse All Versions… you see each past version of the document between occurrences of autosave.


Let's say I create a new RTF TextEdit document, enter the word "cat" and then save it as some.rtf to my Desktop. Afterward, I enter a space and the word "dog". When I browse all versions, I will see the first version with the word "cat" in it and the next version with "cat dog." If I were to Restore the first version, it would overwrite the last document and I would see just "cat."


Closing a TextEdit document without ever saving it will lose everything that was entered and TextEdit, not unlike Pages, will destroy all evidence of any entered text. There won't be any temporary files to be found.


If you open a TextEdit document with previous text in it, autosave is inherited and any content entered is autosaved, even if you close the document and exit TextEdit.


Nothing is stored in the System Cache by TextEdit. Each sandboxed Apple application saves its current application state in data files within its own ~/Library/Containers folder hierarchy.

Apr 24, 2024 1:22 PM in response to ddow77

Autosave and versioning are in TextEdit (Mojave 10.14.6). You would have to be quick to beat autosave as on a local file system it may take ~5 seconds to update the file changes. Reverting to the Last Saved would challenge you to replace the content prior to the last auto/save operation.


What I see in practice is that it is hard to enter something and immediately click the red traffic light to close the document and avoid an autosave that has already occurred, or the close activity might have been written to automatically invoke autosave.


There is no means for you to access any content in the operating system SWAP location regardless of what may have written into it. Here is a backgrounder on UNIX SWAP.


Either you have document content or you don't — there is no Twilight Zone where lost data arrives. Applications are designed to clean up temporary storage or unsaved content when they are quit. Pages does this, and I expect TextEdit does too.

Apr 24, 2024 2:03 AM in response to BDAqua

BDAqua wrote:

The only very thin possibility if not using an SSD, wouold be to immediately quit using the drive & try aData recovery App.

If using an SSD then past things are really immediately gone.


Thanks, I use a standard hard drive but don't 'data recovery' apps work strictly on disk files? My understanding of what happened in my case (text in a TextEdit file was lost when a 'revert changes' save was done) is that the lost data never made it to disk.


If TextEdit doesn't automatically save data, I'm baffled as to why TextEdit file content is preserved without my actively executing a 'save', and where it gets saved to if not 'to disk'.


When I close a TextEdit file without saving, any text I added is retained. I've specifically tested that and is one reason why I thought 'revert changes' would only have removed what hadn't been included in the last autosave -- which would have been (or so I thought) pretty much just all the 'white space' I mentioned in my original post.*


* Is there any way to recover data in a TextEdit file that was closed with 'revert changes'?


Apr 24, 2024 11:41 AM in response to VikingOSX

Thanks, VikingOSX for that detailed explanation, but are autosave and versioning in OS Mojave?


(I posted this in the Earlier Operating Systems forum and am not aware of those functions in my version of TextEdit.)


In Mojave, the ‘revert changes’ function I was referring to is the one TextEdit displays when a file is closed without the user having first saved it.


If there is any kind of autosave and versioning in my TextEdit, the document with the added text that I had not proactively saved myself should have been preserved by those functions, shouldn't it -- or did proactively selecting 'revert changes' wipe all of that text -- i.e., all text added since the last 'normal' save?


Also, even if the text I lost isn’t in a cache, since I haven't resaved the TextEdit doc since I reopened it, is it possible that it’s still stored in a swap location (i.e., on disk)?


My understanding of ‘swaps’ is that the OS temporarily stores data on disk and restores it to memory when needed again (when the file, or that part of it, is in use again). So I wondered whether the lost text might still be in a ‘swap locker’ (so to speak) on my hard disk that might allow me to get it back.


From your reply it seems that even if it was, it might (or would) have been deleted when the TextEdit document was exited without being proactively saved in the normal way (i.e., not with 'revert changes'). Is that the case -- i.e., situation hopeless?


Thanks again.



Apr 27, 2024 9:46 AM in response to VikingOSX

Thanks again, VikingOSX, for that additional information. Maybe I haven't seen any sign of 'autosave' (or 'Reverting to the Last Saved' or 'versioning') because I'm using OS 10.14.3, not 10.14.6 (?)


I only thought autosave was active because of my experience seeing unsaved (by me) content preserved in certain circumstances where I wouldn't have expected the 'unsaved' text to be retained.  


In any event, what happened here is that I thought I was taking a shortcut for getting rid of all the white space that had somehow been added to the document since I had last used it. I assumed, given the time gap since I had last entered any text, that autosave had preserved everything except that white space, and that saving with 'revert changes' would just remove all the 'white space' -- and only that. 


Apparently, if 'revert changes' is selected, everything added to the document since the last 'save' actually executed by the user is wiped out. I don't know what else would explain the loss of everything in the document since the last 'save' actually executed by me because everything after that was gone. That seems odd since it suggests that either 10.14.3 doesn't in fact have 'auto-save' or saving with 'revert changes' ignores it and only looks at user-executed saves.


Can data be retrieved from 'swaps' or 'cache'?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.