Project's Library Cache. What is its purpose?

Windows 7 64Bit Kicad 4.0.5

To my understanding it should: Retain all schematics components, modified or not, pertaining to that schematic irrespective of external library changes. Example, I should be able to give anyone a projects entire folder and they should have no requirement for any additional libraries.

But this happens instead:

1-Loaded an NE555 onto schematic
2-Changed location of VCC and GND using ‘Ctrl + E’
3-Updated schematic. Did not save the part to another Library (part gets saved in the schematics cache).
4-Modified part is now in schematics cache and schematic, no where else.
5-Save the schem and close Kicad completely.
6-If I now open Kicad > schematic it wants to rescue the part with Kicads version.
7-I select cancel I do not want to rescue the part or if I uncheck the selection and click ‘OK’ I want to keep the cache part.
8-Kicad loads the schematic with its library part (pins in original place)
9-Click on ‘Select a component’ and type ‘555’ The cache part comes up first (modified pins)
10-Select the cache part with the modified pins but the library part with the original pins loads.

1-What’s the point of the cache. If external library changes affect the schematics components. I haven’t done it but i’m sure if I rename my custom library to xyz library all schematics will be broken. As it happens with renamed or deleted components.
2-I’ve opened a couple of old schematics and parts rescue wants to update due to original custom library part
no longer existing or having been renamed. It’s in the cache though? Yet the schematic loads with no part.
3-What’s going to happen a few years from now when parts are removed for obsolete or library changes. All schematics
will have to be redone. Will I have to keep a backup version of all Kicad library versions used.
4-I should be able to grab a projects folder and give it to anyone without external libraries. Rescue can come up to advise of differences but ask an not do what it wants.

Note: I haven’t clicked on ‘Never ask again’ for from what I can tell it’s just asking for trouble.

What am I missing?

Thats exactly what the chache library is for. If the library changes, the original symbol is still in this chache library. (This library has the same purpose as the header of the pcb_new file.)

Rescue is i think the wrong name. If the symbol rescue dialog comes up, deselect the symbols you want to keep unchanged. Everything that is selected to be rescued is updated with the current library symbol. Everything that is not selected will stay as is.

Again: This old parts are in the chache library. As long as you do not delete this file you will be fine.

1 Like

Unfortunately, that’s not necessarily true, it depends on if you have the cache lib on your list or not, and other things. It’s quite easy for a library part to be loaded from it’s library instead of the cache, and when you save the schematic file the cache file will be overwritten

Also Rene, and I can’t emphasize this enough:

The behaviour in nightly builds may be quite different from the stable release, so saying “it works fine for me” may be very misleading.

@pauls969 The schematic cache is less useful than it could be, and also apparently contains pitfalls even for experienced users. I find it causes problems and often gets in the way.

Some history, pcbnew “caches” footprints in the kciad_pcb file, but eeschema caches into a standalone file and not the schematic. The idea is that the project can then be “standalone”, but in practice it doesn’t always work like you might expect. In addition, symbol references are context sensitive depending on the library list. (I believe both these things may change in future, but not soon).

Guidelines I try to follow:

  1. In normal use, ignore the cache file. Load symbols direct from libraries, save edits back to the library (or a new symbol with unique name if changing an existing official symbol).
  2. When you publish or archive a project, delete all the existing library entries. Add the cache lib to the list. That guarantees that the cache symbols and only those will be used.

The symbol rescue is an extra spanner in the works, I find it often kicks in incorrectly, but cancelling the dialog is I think always safe.

Thanks Rene, but your responses are exactly as my assumption. It doesn’t work that way though.

It doesn’t work that way.

It doesn’t work that way. 6, 7 and 8 above

It doesn’ work that way. The rescue dialogue still does what it wants.

I think that is the problem, it leads to the beartrap. If you modify a symbol, explicitly save it to a library (and not the cache library!).

Well, The problem is not so much that. For starters it should stick with the cached part, Rescue ignores that and even if I save the part to ‘My Library’ and later change something on that part it can cause problems. Delete a ‘My Library’ part and rescue comes up again doing what it wants to. In general the cache serves no purpose. The part exists in the cache but other than telling you, rescue just replaces it.

Ok, so you’re the expert, you tell us what the problem is and how you solved it :slight_smile:

What “should happen” is not the same as what “actually happens”.

I know the topic of this thread has deviated from the purpose of the library cache…but the purpose of the library cache is so that a project can still be loaded without having a full set of libraries present. Symbols are supposed to be identical between the cache and the library — a misguided design that is haunting us to this day. The “rescue” dialog provides a way to keep old versions still sitting in the cache if a library upgrade would otherwise ruin your project. It solves a complex problem in a way I wasn’t able to simplify any further.

Thankfully all this will be gone with the upcoming new schematic/library file format, which will store symbols per instance exactly the way PCBnew does.

4 Likes

:slight_smile:The problem is as stated. The solution considering I’ve read quite a few complaints and negative comments as to how Kicad handles libraries and most responses are of handed as that is how kicad is. Wouldn’t it be prudent to fix long underlying bugs first before adding fancy features. To me it seems that everything is there it just needs to be made to work as intended.

That’s like telling me that everything I read on the internet is not true. I refuse beleive that!

Ah, the old “there are still bugs, why are you adding features?!?”

  1. Because it’s impossible to fix all the bugs. It will take years. In the meantime the lack of anything new will cause disinterest in both users and developers and the project will die.
  2. Because this issue is much, much more complicated under the surface than it looks. It is not true at all that everything is there and just needs to be made to work.

There are plans in the works to fix this. Wayne Stambaugh, as far as I am aware, is currently hard at work on this particular problem, working towards implementation of the new file format which will be necessary to solve this problem.

1 Like

This answers a lot as to it’s behaivour especially if you delete or alter the name of a library part. Everything screws up.

Unfortunately it doesn’t work that way as in the screenshot I added above. Even clicking on cancel the library part is loaded and cache ignored.

Don’t have to answer but is it going to force retention of old cache parts on previoius versions. Otherwise wouldn’ that break or as currently break existing schematics where rescue ignores the cache.

Or as I ask my boss, “do you want me to fix existing bugs or add new ones?” :slight_smile:

That is the correct behavior. The description in the dialog isn’t all that great - there was a lot of discussion about how to explain the situation to users (who mostly don’t understand the intent behind the library system, which causes this whole mess), and nobody really had anything better :frowning:

KiCad will always overwrite components with those in the libraries, ignoring the cache, if the library is present. It has always done this. Canceling the dialog gets you this behavior.

If you click OK instead, the dialog will extract components form the cache into a new library and add it to the top of the project library config, so that when the components are replaced from library they’re replaced with the old versions that were in the cache anyway - thus rescuing the cached versions from being clobbered.

2 Likes

Ok, I just did a quick test and accepted the rescue.

1- Rescue if checked and ‘OK’ clicked duplicates your existing part into a new library called *rescue. Hence retaining your part in the current schematic.

*You want to keep your part accept rescue.

2- If either the part is unchecked or if ‘Cancel’ is clicked Rescue assumes you want to load the current default library part.

*Want to load default part or updated part. Don’t accept rescue.

Ok, thanks c4757. I get it now.

ANSWER TO OP QUESTION, “What am I missing?”

Going off of your description, this action is what is triggering the “rescue module” on the next load. The library part and the cached part are different. KiCad doesn’t know which one you really wanted to use.

[quote=“pauls969, post:1, topic:5903”]
6-If I now open Kicad > schematic it wants to rescue the part with Kicads version.[/quote]

Doing exactly what it was designed to do.

This is your mistake; you DO want to rescue the part.

If the library gets changed, and the part gets deleted, used “Cntrl+e” as you did, then note that there is no library assigned to the part. Assign it a library and save it.

1 Like

Addition:
I kind of like the solution such as posted on hackaday.
It basically means to rename the “-cache” library to [projectname].lib and then explicitly adding that library to the top of your library search path with:

1). Open your project file with KiCad
2). Open a schematic, or the libary editor.
3). Main Menu -> Preferences -> Component Libraries -> Component library files -> Add -> select your new library.
4). Select your lib in “Component library files” box and press up untill it’s the top library.
5). Save.

Here is an observation related to the interaction between “Append Schematic Sheet” and Symbol Library Cache.

I’m on KiCad 5.0.0. I have two projects “A” and “B”. I want to copy schematic content from A to B. So I open a new hierarchical sheet in B and use “Append Schematic Sheet” there, browse to my project A and select the .sch file, and behold, everthing is hunky dory, picture perfect.

(Now being the sneaky sceptic that I am, I ran a ‘git diff’ on my old project A. Nothing disturbed there; good job, KiCad!)

Still being the curious {your-fave-furry-animal-here} that I am, I ran a ‘git diff’ on my new project (B). As expected, a lot of new content in the hierarchical sheet, and updates to the B-Cache-lib as well, all of which is entirely understandable. But now comes these entries in every .sch within the new project:

 EESchema Schematic File Version 4
 LIBS:B-cache
+LIBS:A-cache
 EELAYER 26 0
 EELAYER END

Which means, there is a new LIBS: entry cross-pointing from project B to project A’s cache. (The line that ‘git diff’ marks with a + in the above, other lines are not new). I flag this additional LIBS: entry as unwanted and risky.

I understand from this forum discussions that when a project is saved, the cache libraries are written into. I fear the scenario of getting my ‘A’ projects cache affected when I update my project ‘B’. Since the reference to caches is hidden from the GUI, I had to edit this LIBS: reference out with a sharp instrument. I can confirm that things continue to work fine after such surgery.

The new cross-linked LIBS: entry is likely unintentional… it might be a bug in waiting, so just letting this forum know.

What version are you running?

I’m running Version 5.0.0.