There are two places where I have come across the notion of a spectrum.
The first is when $R$ is a ring, then $\text{Spec}(R)$ is defined to be the set of all prime ideals, and additionally one can put a topology on this via defining the closed sets to be $V_{I} = \{ p \supset I \,|\, p \text{ is a prime ideal} \} $ for each ideal $I$ of $R$.
Secondly, I have come across the notion of spectrum in the setting of affine $k-$functors/affine group schemes, where given any $k-$algebra $R$ we define $\text{Spec}(R)$ to be the functor taking any $k-$algebra $A$ to the set/group $\text{Spec}(R)(A) := \text{Hom}_{k-alg}(R,A).$
Currently my intuition behind both of these constructions comes directly from the definition of spectrum as "a (continuous) sequence or range".
Namely in the case of rings, I picture dissecting the ring and lying out in front of me all it's prime ideals (perhaps ordered on my imaginary table by inclusion or something), and in the case of $k-$algebras I think about studying properties of the algebra $R$ by studying the $k-$algebra homomorphisms from it over a range of target algebras $A$ - the latter is less of a physical mental image for me, but I suppose if I had to sketch it I would draw a pool of $k-$algebras and apply $\text{Hom}_{k-alg}(R,-)$ to each one.
First of all, these images I have in my head are quiet disjoint besides the fact that both involve some sort of collection/range/span of objects. This suggests to me that other than the fact that the definition of spectrum fits both these constructions quite well there is no real mathematical link between both of them. Is this true?
Secondly, my intuition feels quite shallow and I have the feeling that I am missing the point of these constructions somewhat. Is this the case? And if so how should I be thinking?