So my strategy is to work first and learn second. When I encounter a roadblock I try o learn something new, but in most cases I then quickly forget about it soon. This might happen several times over. Once I had to learn about unix file permissions, I knew all the commands and numbers and what they meant and it all made sense. But now I only remember `chmod +x` and that there is a command named `chown`. This satisfies for my day-to-day needs and is enough so that I can re-learn the thing if necessary.
And for the general context that are important to know in detail I found that teaching is a good way to remember and reinforce. I teach a course every year and every year I am surprised how much I've forgotten. But it quickly comes back after I start preparing materials for the class.
When I was young I used to think that you can learn a thing once and then remember. Now I know that, speaking strictly for myself, this is not the case.