Well, after managing to capture a Giant Cave Spider that was roaming around the surface killing goats and kobold thieves (dunno if she appeared from outside or was a resident, but she fell into my cage without any problem, so I suppose she was a visitor... also she was hidden and a camel spotted her or something and yelled 'Ambush!') I started making a ridiculous long spider maze involved a ton of cage traps and rope chains with kittens tied to them, for the purpose of getting free spider silk. It failed miserably.
However!
I discovered a quick and efficient method of milking the damn spider nearly indefinitely, and I didn't even need to constantly release and re-cage her. This is what I finally built:
###########
^D S D^
+++++++++++
@
D = door
^ = cage trap (if you want to recapture)
+ = fortification
# = wall
The idea is to station a single wrestler (set to harass, but not chase) then lock both doors. Once the spider is properly released, unlock the door that's farther from the spider, and watch as she webs the hell out of your wrestler and tries to get away. Before she does tho, lock the door again. Repeat ad nauseam until you think you got enough silk, then start collecting!
It's important not to make the area too big. About 20 long fortified wall works just fine I think (don't make it too short or the spider won't have enough room to walk and shoot spiders before reaching the door), also it's important that the spider can actually see the exit (seems pathing to a target needs to actually see the clear path). Likewise, don't place the soldier too far away (not sure what's the range, it seems fine at about 7 spaces).
Note that every time you lock the spider again, she'll want to move to some default location, so position your soldier properly and unlock the farthest door.