On Mon, Dec 5, 2011 at 3:06 PM, <pcohen@cegetel.net> wrote:
> Hi
> Thanks for the answer, as I read the book on Cassandra, I was not aware at
> that time on Composite Key which I recently discovered.
>
*Composite Type's are useful for handling data-versions.
*
* *
> * *You mentioned a TTL and let the database remove the date for me. I
> never read about that. Is it possible without an external batch ?
>
*Yes, TTL if set on column, auto delete column for you.*
> I will try to rephrase in any case my goal:
>
> Storage:
> - I would like to store for a user (identified by its id) several carts
> (BLOB).
>
> - Associated to these carts, I would like to attach metadata like
> expiration date and possibly others.
>
> Queries/tasks:
> - I would like to be able to retrieve all the carts of a given userId.
>
*I would use timeline with TTL for carts as separate CF. And cart_Id to
reverse index in userId CF with TTL set on columns. *
- I would like to have a mean to remove expired carts.
>
*set TTL on each column. *
1.
cartCF{
*cart1_uuidkey:{
metadata_column:ttl
}
cart2_uuidkey:{
metadata_column:ttl
}
.
.
.cartN_uuidkey:{
metadata_column:ttl
}*
}
2.
userIdCF:{
*user1:{
id:user1 //*hack : to prevent unwanted behavior one column with no ttl.*
cart1:cart1_uuidkey:ttl
cart2:........ttl
cart3:........ttl
}
user2:{
id:user2
cart1:cartX_uuidkey:ttl
cart2:cart4........:ttl
cart3:cartM........ttl
}*
}
/Samal
|