I’ve messed around with different ways of doing this in the past partly just to try it, and partly being a cheapskate.
The first method I tried was to make a batch of beer as normal, then after racking the beer, taking that yeast slurry with some distilled, swirling it up and then transferring it to some sanitized jars, filling them to the top. Seal the jars loosely (in case there’s still any activity, don’t want the jars exploding) and store them in the fridge. Before using I take a sniff, and if it doesn’t smell bad I’ll make a starter from that slurry to prove it still has vitality/wake it up. I usually don’t decant off the top layer of the jar, but just use the whole thing. The longest I’ve ever had one of the jars in the fridge and used it with success was about 2 months. Never had one of them go bad on me, though I’ve only done this a couple times so maybe I’ve jut been lucky.
The other method is basically like the first one except instead of brewing a beer to start I make a starter (2 l) and then once the starter is completely divide that up equally in to loosely sealed containers in the fridge and then make another starter from each of those when I wanted to brew. If you don’t have smaller jars (I have a bunch of little 500ml jam jars I did this with) you can always top off the jar with sterilized water or make a bigger starter initially.
I liked using the first method better as it got me my first beer quicker than the second method. Though I’d imagine the second method has a better chance of not ending up with anything “off” in the yeast.